From b8be3e2339169af1c3eadc2207653e4c03f55bcc Mon Sep 17 00:00:00 2001 From: Elena Xin Date: Tue, 1 Aug 2023 14:58:35 +0800 Subject: [PATCH 1/7] refactoring to use hashicorp/go-azure-sdk --- .../api_management_api_data_source.go | 69 +- .../api_management_api_diagnostic_resource.go | 223 +- ...management_api_diagnostic_resource_test.go | 12 +- ...anagement_api_operation_policy_resource.go | 74 +- ...ment_api_operation_policy_resource_test.go | 13 +- .../api_management_api_operation_resource.go | 106 +- ..._management_api_operation_resource_test.go | 12 +- ...i_management_api_operation_tag_resource.go | 69 +- ...agement_api_operation_tag_resource_test.go | 12 +- .../api_management_api_policy_resource.go | 65 +- ...api_management_api_policy_resource_test.go | 13 +- .../api_management_api_release.go | 60 +- ...pi_management_api_release_resource_test.go | 12 +- .../api_management_api_resource.go | 357 +- .../api_management_api_resource_test.go | 12 +- .../api_management_api_schema_resource.go | 90 +- ...api_management_api_schema_resource_test.go | 12 +- ...management_api_tag_description_resource.go | 68 +- ...ement_api_tag_description_resource_test.go | 12 +- .../api_management_api_tag_resource.go | 71 +- .../api_management_api_tag_resource_test.go | 12 +- ..._management_api_version_set_data_source.go | 44 +- ...api_management_api_version_set_resource.go | 81 +- ...anagement_api_version_set_resource_test.go | 12 +- ...anagement_authorization_server_resource.go | 218 +- ...ment_authorization_server_resource_test.go | 12 +- .../api_management_backend_resource.go | 207 +- .../api_management_backend_resource_test.go | 23 +- .../api_management_certificate_resource.go | 67 +- ...pi_management_certificate_resource_test.go | 12 +- .../api_management_custom_domain_resource.go | 127 +- ..._management_custom_domain_resource_test.go | 12 +- .../api_management_data_source.go | 176 +- .../api_management_diagnostic_resource.go | 273 +- ...api_management_diagnostic_resource_test.go | 12 +- .../api_management_email_template_resource.go | 112 +- ...management_email_template_resource_test.go | 17 +- .../api_management_gateway_api_resource.go | 75 +- ...pi_management_gateway_api_resource_test.go | 19 +- ..._gateway_certificate_authority_resource.go | 51 +- ...way_certificate_authority_resource_test.go | 12 +- .../api_management_gateway_data_source.go | 36 +- ...way_host_name_configuration_data_source.go | 47 +- ...ateway_host_name_configuration_resource.go | 75 +- ...y_host_name_configuration_resource_test.go | 12 +- .../api_management_gateway_resource.go | 83 +- .../api_management_gateway_resource_test.go | 12 +- .../api_management_global_schema_resource.go | 1 + ..._management_global_schema_resource_test.go | 6 +- .../api_management_group_data_source.go | 33 +- .../api_management_group_resource.go | 69 +- .../api_management_group_resource_test.go | 12 +- .../api_management_group_user_resource.go | 38 +- ...api_management_group_user_resource_test.go | 17 +- ...nagement_identity_provider_aad_resource.go | 61 +- ...ent_identity_provider_aad_resource_test.go | 13 +- ...ement_identity_provider_aadb2c_resource.go | 77 +- ..._identity_provider_aadb2c_resource_test.go | 14 +- ...ent_identity_provider_facebook_resource.go | 56 +- ...dentity_provider_facebook_resource_test.go | 13 +- ...ement_identity_provider_google_resource.go | 56 +- ..._identity_provider_google_resource_test.go | 13 +- ...nt_identity_provider_microsoft_resource.go | 56 +- ...entity_provider_microsoft_resource_test.go | 13 +- ...ment_identity_provider_twitter_resource.go | 58 +- ...identity_provider_twitter_resource_test.go | 13 +- .../api_management_logger_resource.go | 112 +- .../api_management_logger_resource_test.go | 12 +- .../api_management_named_value_resource.go | 90 +- ...pi_management_named_value_resource_test.go | 12 +- ...management_notification_recipient_email.go | 63 +- ...ement_notification_recipient_email_test.go | 25 +- ..._management_notification_recipient_user.go | 63 +- ...gement_notification_recipient_user_test.go | 25 +- ...gement_openid_connect_provider_resource.go | 62 +- ...t_openid_connect_provider_resource_test.go | 12 +- .../api_management_policy_resource.go | 91 +- .../api_management_policy_resource_test.go | 16 +- .../api_management_product_api_resource.go | 40 +- ...pi_management_product_api_resource_test.go | 12 +- .../api_management_product_data_source.go | 33 +- .../api_management_product_group_resource.go | 36 +- ..._management_product_group_resource_test.go | 12 +- .../api_management_product_policy_resource.go | 77 +- ...management_product_policy_resource_test.go | 13 +- .../api_management_product_resource.go | 82 +- .../api_management_product_resource_test.go | 12 +- .../api_management_product_tag_resource.go | 56 +- ...pi_management_product_tag_resource_test.go | 12 +- .../api_management_redis_cache_resource.go | 59 +- ...pi_management_redis_cache_resource_test.go | 15 +- .../apimanagement/api_management_resource.go | 1017 +- .../api_management_resource_test.go | 53 +- .../api_management_subscription_resource.go | 110 +- ...i_management_subscription_resource_test.go | 12 +- .../api_management_tag_resource.go | 46 +- .../api_management_tag_resource_test.go | 12 +- .../api_management_user_data_source.go | 23 +- .../api_management_user_resource.go | 81 +- .../api_management_user_resource_test.go | 12 +- .../services/apimanagement/client/client.go | 529 +- .../apimanagement/identity_provider_import.go | 9 +- .../api_operation_policy_v0_to_v1.go | 67 + .../migration/api_policy_v0_to_v1.go | 61 + .../migration/api_product_policy_v0_to_v1.go | 60 + .../apimanagement/migration/policy.go | 28 +- .../migration/policy_v1_to_v2.go | 31 + .../apimanagement/schemaz/api_management.go | 138 +- .../2021-08-01/apimanagement/CHANGELOG.md | 2 - .../mgmt/2021-08-01/apimanagement/_meta.json | 11 - .../mgmt/2021-08-01/apimanagement/api.go | 822 - .../2021-08-01/apimanagement/apidiagnostic.go | 711 - .../2021-08-01/apimanagement/apiexport.go | 128 - .../mgmt/2021-08-01/apimanagement/apiissue.go | 688 - .../apimanagement/apiissueattachment.go | 610 - .../apimanagement/apiissuecomment.go | 608 - .../2021-08-01/apimanagement/apioperation.go | 705 - .../apimanagement/apioperationpolicy.go | 540 - .../2021-08-01/apimanagement/apipolicy.go | 509 - .../2021-08-01/apimanagement/apiproduct.go | 183 - .../2021-08-01/apimanagement/apirelease.go | 675 - .../2021-08-01/apimanagement/apirevision.go | 183 - .../2021-08-01/apimanagement/apischema.go | 592 - .../apimanagement/apitagdescription.go | 594 - .../2021-08-01/apimanagement/apiversionset.go | 649 - .../apimanagement/authorizationserver.go | 746 - .../mgmt/2021-08-01/apimanagement/backend.go | 742 - .../mgmt/2021-08-01/apimanagement/cache.go | 653 - .../2021-08-01/apimanagement/certificate.go | 650 - .../mgmt/2021-08-01/apimanagement/client.go | 146 - .../2021-08-01/apimanagement/contentitem.go | 546 - .../2021-08-01/apimanagement/contenttype.go | 438 - .../apimanagement/delegationsettings.go | 465 - .../apimanagement/deletedservices.go | 316 - .../2021-08-01/apimanagement/diagnostic.go | 681 - .../2021-08-01/apimanagement/emailtemplate.go | 632 - .../mgmt/2021-08-01/apimanagement/enums.go | 1221 -- .../mgmt/2021-08-01/apimanagement/gateway.go | 933 - .../2021-08-01/apimanagement/gatewayapi.go | 472 - .../gatewaycertificateauthority.go | 580 - .../gatewayhostnameconfiguration.go | 574 - .../mgmt/2021-08-01/apimanagement/group.go | 647 - .../2021-08-01/apimanagement/groupuser.go | 467 - .../apimanagement/identityprovider.go | 697 - .../mgmt/2021-08-01/apimanagement/issue.go | 272 - .../mgmt/2021-08-01/apimanagement/logger.go | 645 - .../mgmt/2021-08-01/apimanagement/models.go | 17367 ---------------- .../2021-08-01/apimanagement/namedvalue.go | 841 - .../2021-08-01/apimanagement/networkstatus.go | 207 - .../2021-08-01/apimanagement/notification.go | 349 - .../notificationrecipientemail.go | 381 - .../notificationrecipientuser.go | 390 - .../apimanagement/openidconnectprovider.go | 736 - .../2021-08-01/apimanagement/operation.go | 194 - .../2021-08-01/apimanagement/operations.go | 140 - .../outboundnetworkdependenciesendpoints.go | 118 - .../mgmt/2021-08-01/apimanagement/policy.go | 474 - .../apimanagement/policydescription.go | 121 - .../apimanagement/portalrevision.go | 561 - .../apimanagement/portalsettings.go | 116 - .../privateendpointconnection.go | 552 - .../mgmt/2021-08-01/apimanagement/product.go | 815 - .../2021-08-01/apimanagement/productapi.go | 473 - .../2021-08-01/apimanagement/productgroup.go | 463 - .../2021-08-01/apimanagement/productpolicy.go | 499 - .../apimanagement/productsubscriptions.go | 190 - .../apimanagement/quotabycounterkeys.go | 216 - .../apimanagement/quotabyperiodkeys.go | 219 - .../mgmt/2021-08-01/apimanagement/region.go | 158 - .../mgmt/2021-08-01/apimanagement/reports.go | 1220 -- .../mgmt/2021-08-01/apimanagement/service.go | 1148 - .../2021-08-01/apimanagement/serviceskus.go | 158 - .../apimanagement/signinsettings.go | 380 - .../apimanagement/signupsettings.go | 380 - .../mgmt/2021-08-01/apimanagement/skus.go | 144 - .../2021-08-01/apimanagement/subscription.go | 959 - .../mgmt/2021-08-01/apimanagement/tag.go | 2295 -- .../2021-08-01/apimanagement/tagresource.go | 188 - .../2021-08-01/apimanagement/tenantaccess.go | 773 - .../apimanagement/tenantaccessgit.go | 202 - .../apimanagement/tenantconfiguration.go | 404 - .../apimanagement/tenantsettings.go | 247 - .../mgmt/2021-08-01/apimanagement/user.go | 866 - .../apimanagement/userconfirmationpassword.go | 128 - .../2021-08-01/apimanagement/usergroup.go | 185 - .../apimanagement/useridentities.go | 163 - .../apimanagement/usersubscription.go | 285 - .../mgmt/2021-08-01/apimanagement/version.go | 19 - .../apimanagement/2021-08-01/api/README.md | 123 + .../apimanagement/2021-08-01/api/client.go | 26 + .../apimanagement/2021-08-01/api/constants.go | 304 + .../apimanagement/2021-08-01/api/id_api.go | 140 + .../2021-08-01/api/id_service.go | 127 + .../2021-08-01/api/method_createorupdate.go | 103 + .../2021-08-01/api/method_delete.go | 79 + .../2021-08-01/api/method_get.go | 51 + .../2021-08-01/api/method_getentitytag.go | 46 + .../2021-08-01/api/method_listbyservice.go | 133 + .../2021-08-01/api/method_update.go | 84 + .../api/model_apicontactinformation.go | 10 + .../2021-08-01/api/model_apicontract.go | 11 + .../api/model_apicontractproperties.go | 28 + .../api/model_apicontractupdateproperties.go | 26 + .../api/model_apicreateorupdateparameter.go | 8 + .../api/model_apicreateorupdateproperties.go | 32 + ...apicreateorupdatepropertieswsdlselector.go | 9 + .../api/model_apilicenseinformation.go | 9 + .../2021-08-01/api/model_apiupdatecontract.go | 8 + .../api/model_apiversionsetcontractdetails.go | 13 + .../model_authenticationsettingscontract.go | 9 + ...el_oauth2authenticationsettingscontract.go | 9 + ...el_openidauthenticationsettingscontract.go | 9 + ...l_subscriptionkeyparameternamescontract.go | 9 + .../2021-08-01/api/predicates.go | 27 + .../apimanagement/2021-08-01/api/version.go | 12 + .../2021-08-01/apidiagnostic/README.md | 127 + .../2021-08-01/apidiagnostic/client.go | 26 + .../2021-08-01/apidiagnostic/constants.go | 256 + .../2021-08-01/apidiagnostic/id_api.go | 140 + .../apidiagnostic/id_apidiagnostic.go | 153 + .../apidiagnostic/method_createorupdate.go | 85 + .../2021-08-01/apidiagnostic/method_delete.go | 76 + .../2021-08-01/apidiagnostic/method_get.go | 51 + .../apidiagnostic/method_getentitytag.go | 46 + .../apidiagnostic/method_listbyservice.go | 125 + .../2021-08-01/apidiagnostic/method_update.go | 84 + .../model_bodydiagnosticsettings.go | 8 + .../apidiagnostic/model_datamasking.go | 9 + .../apidiagnostic/model_datamaskingentity.go | 9 + .../apidiagnostic/model_diagnosticcontract.go | 11 + .../model_diagnosticcontractproperties.go | 17 + .../model_httpmessagediagnostic.go | 10 + .../model_pipelinediagnosticsettings.go | 9 + .../apidiagnostic/model_samplingsettings.go | 9 + .../2021-08-01/apidiagnostic/predicates.go | 27 + .../2021-08-01/apidiagnostic/version.go | 12 + .../2021-08-01/apimanagementservice/README.md | 220 + .../2021-08-01/apimanagementservice/client.go | 26 + .../apimanagementservice/constants.go | 509 + .../apimanagementservice/id_service.go | 127 + ...method_applynetworkconfigurationupdates.go | 74 + .../apimanagementservice/method_backup.go | 74 + .../method_checknameavailability.go | 57 + .../method_createorupdate.go | 75 + .../apimanagementservice/method_delete.go | 71 + .../apimanagementservice/method_get.go | 51 + .../method_getdomainownershipidentifier.go | 53 + .../method_getssotoken.go | 52 + .../apimanagementservice/method_list.go | 90 + .../method_listbyresourcegroup.go | 90 + .../apimanagementservice/method_restore.go | 74 + .../apimanagementservice/method_update.go | 74 + .../model_additionallocation.go | 21 + ...viceapplynetworkconfigurationparameters.go | 8 + ...anagementservicebackuprestoreparameters.go | 13 + ...tservicechecknameavailabilityparameters.go | 8 + ...rvicegetdomainownershipidentifierresult.go | 8 + ...l_apimanagementservicegetssotokenresult.go | 8 + ...managementservicenameavailabilityresult.go | 10 + .../model_apimanagementserviceproperties.go | 53 + .../model_apimanagementserviceresource.go | 24 + ...model_apimanagementserviceskuproperties.go | 9 + ...el_apimanagementserviceupdateparameters.go | 21 + ...el_apimanagementserviceupdateproperties.go | 53 + .../model_apiversionconstraint.go | 8 + .../model_armidwrapper.go | 8 + .../model_certificateconfiguration.go | 11 + .../model_certificateinformation.go | 25 + .../model_hostnameconfiguration.go | 18 + ...vateendpointconnectionwrapperproperties.go | 11 + ...model_privatelinkserviceconnectionstate.go | 10 + ..._remoteprivateendpointconnectionwrapper.go | 11 + .../model_virtualnetworkconfiguration.go | 10 + .../apimanagementservice/predicates.go | 37 + .../apimanagementservice/version.go | 12 + .../2021-08-01/apioperation/README.md | 127 + .../2021-08-01/apioperation/client.go | 26 + .../2021-08-01/apioperation/id_api.go | 140 + .../2021-08-01/apioperation/id_operation.go | 153 + .../apioperation/method_createorupdate.go | 85 + .../2021-08-01/apioperation/method_delete.go | 76 + .../2021-08-01/apioperation/method_get.go | 51 + .../apioperation/method_getentitytag.go | 46 + .../apioperation/method_listbyapi.go | 129 + .../2021-08-01/apioperation/method_update.go | 84 + .../apioperation/model_operationcontract.go | 11 + .../model_operationcontractproperties.go | 15 + .../model_operationupdatecontract.go | 8 + ...model_operationupdatecontractproperties.go | 15 + .../apioperation/model_parametercontract.go | 16 + .../model_parameterexamplecontract.go | 11 + .../model_representationcontract.go | 12 + .../apioperation/model_requestcontract.go | 11 + .../apioperation/model_responsecontract.go | 11 + .../2021-08-01/apioperation/predicates.go | 27 + .../2021-08-01/apioperation/version.go | 12 + .../2021-08-01/apioperationpolicy/README.md | 105 + .../2021-08-01/apioperationpolicy/client.go | 26 + .../apioperationpolicy/constants.go | 98 + .../apioperationpolicy/id_operation.go | 153 + .../method_createorupdate.go | 85 + .../apioperationpolicy/method_delete.go | 76 + .../apioperationpolicy/method_get.go | 80 + .../apioperationpolicy/method_getentitytag.go | 47 + .../method_listbyoperation.go | 52 + .../model_policycollection.go | 10 + .../model_policycontract.go | 11 + .../model_policycontractproperties.go | 9 + .../2021-08-01/apioperationpolicy/version.go | 12 + .../2021-08-01/apioperationtag/README.md | 101 + .../2021-08-01/apioperationtag/client.go | 26 + .../apioperationtag/id_operation.go | 153 + .../apioperationtag/id_operationtag.go | 166 + .../method_tagassigntooperation.go | 52 + .../method_tagdetachfromoperation.go | 47 + .../method_taggetbyoperation.go | 51 + .../method_taggetentitystatebyoperation.go | 46 + .../method_taglistbyoperation.go | 125 + .../apioperationtag/model_tagcontract.go | 11 + .../model_tagcontractproperties.go | 8 + .../2021-08-01/apioperationtag/predicates.go | 27 + .../2021-08-01/apioperationtag/version.go | 12 + .../2021-08-01/apipolicy/README.md | 105 + .../2021-08-01/apipolicy/client.go | 26 + .../2021-08-01/apipolicy/constants.go | 98 + .../2021-08-01/apipolicy/id_api.go | 140 + .../apipolicy/method_createorupdate.go | 85 + .../2021-08-01/apipolicy/method_delete.go | 76 + .../2021-08-01/apipolicy/method_get.go | 80 + .../apipolicy/method_getentitytag.go | 47 + .../2021-08-01/apipolicy/method_listbyapi.go | 52 + .../apipolicy/model_policycollection.go | 10 + .../apipolicy/model_policycontract.go | 11 + .../model_policycontractproperties.go | 9 + .../2021-08-01/apipolicy/version.go | 12 + .../2021-08-01/apirelease/README.md | 127 + .../2021-08-01/apirelease/client.go | 26 + .../2021-08-01/apirelease/id_api.go | 140 + .../2021-08-01/apirelease/id_release.go | 153 + .../apirelease/method_createorupdate.go | 85 + .../2021-08-01/apirelease/method_delete.go | 76 + .../2021-08-01/apirelease/method_get.go | 51 + .../apirelease/method_getentitytag.go | 46 + .../apirelease/method_listbyservice.go | 125 + .../2021-08-01/apirelease/method_update.go | 84 + .../apirelease/model_apireleasecontract.go | 11 + .../model_apireleasecontractproperties.go | 41 + .../2021-08-01/apirelease/predicates.go | 27 + .../2021-08-01/apirelease/version.go | 12 + .../2021-08-01/apischema/README.md | 102 + .../2021-08-01/apischema/client.go | 26 + .../2021-08-01/apischema/id_api.go | 140 + .../2021-08-01/apischema/id_apischema.go | 153 + .../apischema/method_createorupdate.go | 103 + .../2021-08-01/apischema/method_delete.go | 79 + .../2021-08-01/apischema/method_get.go | 51 + .../apischema/method_getentitytag.go | 46 + .../2021-08-01/apischema/method_listbyapi.go | 125 + .../apischema/model_schemacontract.go | 11 + .../model_schemacontractproperties.go | 9 + .../model_schemadocumentproperties.go | 10 + .../2021-08-01/apischema/predicates.go | 27 + .../2021-08-01/apischema/version.go | 12 + .../apimanagement/2021-08-01/apitag/README.md | 101 + .../apimanagement/2021-08-01/apitag/client.go | 26 + .../apimanagement/2021-08-01/apitag/id_api.go | 140 + .../2021-08-01/apitag/id_apitag.go | 153 + .../apitag/method_tagassigntoapi.go | 52 + .../apitag/method_tagdetachfromapi.go | 47 + .../2021-08-01/apitag/method_taggetbyapi.go | 51 + .../apitag/method_taggetentitystatebyapi.go | 46 + .../2021-08-01/apitag/method_taglistbyapi.go | 125 + .../2021-08-01/apitag/model_tagcontract.go | 11 + .../apitag/model_tagcontractproperties.go | 8 + .../2021-08-01/apitag/predicates.go | 27 + .../2021-08-01/apitag/version.go | 12 + .../2021-08-01/apitagdescription/README.md | 106 + .../2021-08-01/apitagdescription/client.go | 26 + .../2021-08-01/apitagdescription/id_api.go | 140 + .../apitagdescription/id_tagdescription.go | 153 + .../method_createorupdate.go | 85 + .../apitagdescription/method_delete.go | 76 + .../apitagdescription/method_get.go | 51 + .../apitagdescription/method_getentitytag.go | 46 + .../apitagdescription/method_listbyservice.go | 125 + .../model_tagdescriptionbaseproperties.go | 10 + .../model_tagdescriptioncontract.go | 11 + .../model_tagdescriptioncontractproperties.go | 12 + .../model_tagdescriptioncreateparameters.go | 8 + .../apitagdescription/predicates.go | 27 + .../2021-08-01/apitagdescription/version.go | 12 + .../2021-08-01/apiversionset/README.md | 111 + .../2021-08-01/apiversionset/client.go | 26 + .../2021-08-01/apiversionset/constants.go | 54 + .../apiversionset/id_apiversionset.go | 140 + .../2021-08-01/apiversionset/id_service.go | 127 + .../apiversionset/method_createorupdate.go | 85 + .../2021-08-01/apiversionset/method_get.go | 51 + .../apiversionset/method_getentitytag.go | 46 + .../apiversionset/method_listbyservice.go | 125 + .../2021-08-01/apiversionset/method_update.go | 84 + .../model_apiversionsetcontract.go | 11 + .../model_apiversionsetcontractproperties.go | 12 + .../model_apiversionsetupdateparameters.go | 8 + ...apiversionsetupdateparametersproperties.go | 12 + .../2021-08-01/apiversionset/predicates.go | 27 + .../2021-08-01/apiversionset/version.go | 12 + .../2021-08-01/apiversionsets/client.go | 26 + .../apiversionsets/id_apiversionset.go | 140 + .../method_apiversionsetdelete.go | 76 + .../2021-08-01/apiversionsets/version.go | 12 + .../2021-08-01/authorizationserver/README.md | 143 + .../2021-08-01/authorizationserver/client.go | 26 + .../authorizationserver/constants.go | 198 + .../id_authorizationserver.go | 140 + .../authorizationserver/id_service.go | 127 + .../method_createorupdate.go | 85 + .../authorizationserver/method_delete.go | 76 + .../authorizationserver/method_get.go | 51 + .../method_getentitytag.go | 46 + .../method_listbyservice.go | 125 + .../authorizationserver/method_listsecrets.go | 52 + .../authorizationserver/method_update.go | 84 + .../model_authorizationservercontract.go | 11 + ...l_authorizationservercontractproperties.go | 23 + ...odel_authorizationserversecretscontract.go | 10 + ...model_authorizationserverupdatecontract.go | 11 + ...orizationserverupdatecontractproperties.go | 23 + .../model_tokenbodyparametercontract.go | 9 + .../authorizationserver/predicates.go | 27 + .../2021-08-01/authorizationserver/version.go | 12 + .../2021-08-01/backend/README.md | 127 + .../2021-08-01/backend/client.go | 26 + .../2021-08-01/backend/constants.go | 51 + .../2021-08-01/backend/id_backend.go | 140 + .../2021-08-01/backend/id_service.go | 127 + .../backend/method_createorupdate.go | 85 + .../2021-08-01/backend/method_delete.go | 76 + .../2021-08-01/backend/method_get.go | 51 + .../2021-08-01/backend/method_getentitytag.go | 46 + .../backend/method_listbyservice.go | 125 + .../2021-08-01/backend/method_update.go | 84 + ...l_backendauthorizationheadercredentials.go | 9 + .../backend/model_backendcontract.go | 11 + .../model_backendcontractproperties.go | 16 + .../model_backendcredentialscontract.go | 12 + .../backend/model_backendproperties.go | 8 + .../backend/model_backendproxycontract.go | 10 + ...l_backendservicefabricclusterproperties.go | 13 + .../backend/model_backendtlsproperties.go | 9 + .../model_backendupdateparameterproperties.go | 16 + .../backend/model_backendupdateparameters.go | 8 + .../backend/model_x509certificatename.go | 9 + .../2021-08-01/backend/predicates.go | 27 + .../2021-08-01/backend/version.go | 12 + .../apimanagement/2021-08-01/cache/README.md | 127 + .../apimanagement/2021-08-01/cache/client.go | 26 + .../2021-08-01/cache/id_cache.go | 140 + .../2021-08-01/cache/id_service.go | 127 + .../2021-08-01/cache/method_createorupdate.go | 85 + .../2021-08-01/cache/method_delete.go | 76 + .../2021-08-01/cache/method_get.go | 51 + .../2021-08-01/cache/method_getentitytag.go | 46 + .../2021-08-01/cache/method_listbyservice.go | 121 + .../2021-08-01/cache/method_update.go | 84 + .../2021-08-01/cache/model_cachecontract.go | 11 + .../cache/model_cachecontractproperties.go | 11 + .../cache/model_cacheupdateparameters.go | 8 + .../cache/model_cacheupdateproperties.go | 11 + .../2021-08-01/cache/predicates.go | 27 + .../apimanagement/2021-08-01/cache/version.go | 12 + .../2021-08-01/certificate/README.md | 122 + .../2021-08-01/certificate/client.go | 26 + .../2021-08-01/certificate/id_certificate.go | 140 + .../2021-08-01/certificate/id_service.go | 127 + .../certificate/method_createorupdate.go | 85 + .../2021-08-01/certificate/method_delete.go | 76 + .../2021-08-01/certificate/method_get.go | 51 + .../certificate/method_getentitytag.go | 46 + .../certificate/method_listbyservice.go | 129 + .../certificate/method_refreshsecret.go | 52 + .../certificate/model_certificatecontract.go | 11 + .../model_certificatecontractproperties.go | 26 + ...del_certificatecreateorupdateparameters.go | 8 + ...del_certificatecreateorupdateproperties.go | 10 + .../model_keyvaultcontractcreateproperties.go | 9 + .../model_keyvaultcontractproperties.go | 10 + ...vaultlastaccessstatuscontractproperties.go | 28 + .../2021-08-01/certificate/predicates.go | 27 + .../2021-08-01/certificate/version.go | 12 + .../2021-08-01/delegationsettings/README.md | 110 + .../2021-08-01/delegationsettings/client.go | 26 + .../delegationsettings/id_service.go | 127 + .../method_createorupdate.go | 84 + .../delegationsettings/method_get.go | 52 + .../delegationsettings/method_getentitytag.go | 47 + .../delegationsettings/method_listsecrets.go | 52 + .../delegationsettings/method_update.go | 79 + .../model_portaldelegationsettings.go | 11 + ...odel_portaldelegationsettingsproperties.go | 11 + ...odel_portalsettingvalidationkeycontract.go | 8 + ...egistrationdelegationsettingsproperties.go | 8 + ...bscriptionsdelegationsettingsproperties.go | 8 + .../2021-08-01/delegationsettings/version.go | 12 + .../2021-08-01/deletedservice/README.md | 65 + .../2021-08-01/deletedservice/client.go | 26 + .../deletedservice/id_deletedservice.go | 127 + .../deletedservice/method_getbyname.go | 51 + .../method_listbysubscription.go | 90 + .../2021-08-01/deletedservice/method_purge.go | 71 + .../model_deletedservicecontract.go | 12 + .../model_deletedservicecontractproperties.go | 40 + .../2021-08-01/deletedservice/predicates.go | 32 + .../2021-08-01/deletedservice/version.go | 12 + .../2021-08-01/diagnostic/README.md | 127 + .../2021-08-01/diagnostic/client.go | 26 + .../2021-08-01/diagnostic/constants.go | 256 + .../2021-08-01/diagnostic/id_diagnostic.go | 140 + .../2021-08-01/diagnostic/id_service.go | 127 + .../diagnostic/method_createorupdate.go | 85 + .../2021-08-01/diagnostic/method_delete.go | 76 + .../2021-08-01/diagnostic/method_get.go | 51 + .../diagnostic/method_getentitytag.go | 46 + .../diagnostic/method_listbyservice.go | 125 + .../2021-08-01/diagnostic/method_update.go | 84 + .../model_bodydiagnosticsettings.go | 8 + .../diagnostic/model_datamasking.go | 9 + .../diagnostic/model_datamaskingentity.go | 9 + .../diagnostic/model_diagnosticcontract.go | 11 + .../model_diagnosticcontractproperties.go | 17 + .../diagnostic/model_httpmessagediagnostic.go | 10 + .../model_pipelinediagnosticsettings.go | 9 + .../diagnostic/model_samplingsettings.go | 9 + .../2021-08-01/diagnostic/predicates.go | 27 + .../2021-08-01/diagnostic/version.go | 12 + .../2021-08-01/emailtemplates/README.md | 110 + .../2021-08-01/emailtemplates/client.go | 26 + .../2021-08-01/emailtemplates/constants.go | 87 + .../2021-08-01/emailtemplates/id_template.go | 156 + .../method_emailtemplatecreateorupdate.go | 85 + .../method_emailtemplatedelete.go | 76 + .../emailtemplates/method_emailtemplateget.go | 51 + .../method_emailtemplategetentitytag.go | 46 + .../method_emailtemplateupdate.go | 84 + .../model_emailtemplatecontract.go | 11 + .../model_emailtemplatecontractproperties.go | 13 + ...ailtemplateparameterscontractproperties.go | 10 + ..._emailtemplateupdateparameterproperties.go | 12 + .../model_emailtemplateupdateparameters.go | 8 + .../2021-08-01/emailtemplates/version.go | 12 + .../2021-08-01/gateway/README.md | 127 + .../2021-08-01/gateway/client.go | 26 + .../2021-08-01/gateway/id_gateway.go | 140 + .../2021-08-01/gateway/id_service.go | 127 + .../gateway/method_createorupdate.go | 85 + .../2021-08-01/gateway/method_delete.go | 76 + .../2021-08-01/gateway/method_get.go | 51 + .../2021-08-01/gateway/method_getentitytag.go | 46 + .../gateway/method_listbyservice.go | 125 + .../2021-08-01/gateway/method_update.go | 84 + .../gateway/model_gatewaycontract.go | 11 + .../model_gatewaycontractproperties.go | 9 + .../model_resourcelocationdatacontract.go | 11 + .../2021-08-01/gateway/predicates.go | 27 + .../2021-08-01/gateway/version.go | 12 + .../2021-08-01/gatewayapi/README.md | 90 + .../2021-08-01/gatewayapi/client.go | 26 + .../2021-08-01/gatewayapi/constants.go | 227 + .../2021-08-01/gatewayapi/id_gateway.go | 140 + .../2021-08-01/gatewayapi/id_gatewayapi.go | 153 + .../gatewayapi/method_createorupdate.go | 56 + .../2021-08-01/gatewayapi/method_delete.go | 47 + .../gatewayapi/method_getentitytag.go | 46 + .../gatewayapi/method_listbyservice.go | 125 + .../gatewayapi/model_apicontactinformation.go | 10 + .../gatewayapi/model_apicontract.go | 11 + .../gatewayapi/model_apicontractproperties.go | 28 + .../gatewayapi/model_apilicenseinformation.go | 9 + .../model_apiversionsetcontractdetails.go | 13 + .../gatewayapi/model_associationcontract.go | 11 + .../model_associationcontractproperties.go | 8 + .../model_authenticationsettingscontract.go | 9 + ...el_oauth2authenticationsettingscontract.go | 9 + ...el_openidauthenticationsettingscontract.go | 9 + ...l_subscriptionkeyparameternamescontract.go | 9 + .../2021-08-01/gatewayapi/predicates.go | 27 + .../2021-08-01/gatewayapi/version.go | 12 + .../gatewaycertificateauthority/README.md | 106 + .../gatewaycertificateauthority/client.go | 26 + .../id_certificateauthority.go | 153 + .../gatewaycertificateauthority/id_gateway.go | 140 + .../method_createorupdate.go | 85 + .../method_delete.go | 76 + .../gatewaycertificateauthority/method_get.go | 51 + .../method_getentitytag.go | 46 + .../method_listbyservice.go | 125 + ...del_gatewaycertificateauthoritycontract.go | 11 + ...ycertificateauthoritycontractproperties.go | 8 + .../gatewaycertificateauthority/predicates.go | 27 + .../gatewaycertificateauthority/version.go | 12 + .../gatewayhostnameconfiguration/README.md | 106 + .../gatewayhostnameconfiguration/client.go | 26 + .../id_gateway.go | 140 + .../id_hostnameconfiguration.go | 153 + .../method_createorupdate.go | 85 + .../method_delete.go | 76 + .../method_get.go | 51 + .../method_getentitytag.go | 46 + .../method_listbyservice.go | 125 + ...el_gatewayhostnameconfigurationcontract.go | 11 + ...hostnameconfigurationcontractproperties.go | 13 + .../predicates.go | 27 + .../gatewayhostnameconfiguration/version.go | 12 + .../apimanagement/2021-08-01/group/README.md | 127 + .../apimanagement/2021-08-01/group/client.go | 26 + .../2021-08-01/group/constants.go | 54 + .../2021-08-01/group/id_group.go | 140 + .../2021-08-01/group/id_service.go | 127 + .../2021-08-01/group/method_createorupdate.go | 85 + .../2021-08-01/group/method_delete.go | 76 + .../2021-08-01/group/method_get.go | 51 + .../2021-08-01/group/method_getentitytag.go | 46 + .../2021-08-01/group/method_listbyservice.go | 125 + .../2021-08-01/group/method_update.go | 84 + .../2021-08-01/group/model_groupcontract.go | 11 + .../group/model_groupcontractproperties.go | 12 + .../group/model_groupcreateparameters.go | 8 + .../model_groupcreateparametersproperties.go | 11 + .../group/model_groupupdateparameters.go | 8 + .../model_groupupdateparametersproperties.go | 11 + .../2021-08-01/group/predicates.go | 27 + .../apimanagement/2021-08-01/group/version.go | 12 + .../2021-08-01/groupuser/README.md | 85 + .../2021-08-01/groupuser/client.go | 26 + .../2021-08-01/groupuser/constants.go | 101 + .../2021-08-01/groupuser/id_group.go | 140 + .../2021-08-01/groupuser/id_groupuser.go | 153 + .../groupuser/method_checkentityexists.go | 46 + .../2021-08-01/groupuser/method_create.go | 52 + .../2021-08-01/groupuser/method_delete.go | 47 + .../2021-08-01/groupuser/method_list.go | 125 + .../model_groupcontractproperties.go | 12 + .../groupuser/model_usercontract.go | 11 + .../groupuser/model_usercontractproperties.go | 33 + .../groupuser/model_useridentitycontract.go | 9 + .../2021-08-01/groupuser/predicates.go | 27 + .../2021-08-01/groupuser/version.go | 12 + .../2021-08-01/identityprovider/README.md | 143 + .../2021-08-01/identityprovider/client.go | 26 + .../2021-08-01/identityprovider/constants.go | 63 + .../identityprovider/id_identityprovider.go | 156 + .../2021-08-01/identityprovider/id_service.go | 127 + .../identityprovider/method_createorupdate.go | 85 + .../identityprovider/method_delete.go | 76 + .../2021-08-01/identityprovider/method_get.go | 51 + .../identityprovider/method_getentitytag.go | 46 + .../identityprovider/method_listbyservice.go | 89 + .../identityprovider/method_listsecrets.go | 52 + .../identityprovider/method_update.go | 84 + .../model_clientsecretcontract.go | 8 + .../model_identityprovidercontract.go | 11 + ...odel_identityprovidercontractproperties.go | 17 + .../model_identityprovidercreatecontract.go | 11 + ...dentityprovidercreatecontractproperties.go | 17 + .../model_identityproviderupdateparameters.go | 8 + .../model_identityproviderupdateproperties.go | 17 + .../2021-08-01/identityprovider/predicates.go | 27 + .../2021-08-01/identityprovider/version.go | 12 + .../apimanagement/2021-08-01/logger/README.md | 127 + .../apimanagement/2021-08-01/logger/client.go | 26 + .../2021-08-01/logger/constants.go | 54 + .../2021-08-01/logger/id_logger.go | 140 + .../2021-08-01/logger/id_service.go | 127 + .../logger/method_createorupdate.go | 85 + .../2021-08-01/logger/method_delete.go | 76 + .../2021-08-01/logger/method_get.go | 51 + .../2021-08-01/logger/method_getentitytag.go | 46 + .../2021-08-01/logger/method_listbyservice.go | 125 + .../2021-08-01/logger/method_update.go | 84 + .../2021-08-01/logger/model_loggercontract.go | 11 + .../logger/model_loggercontractproperties.go | 12 + .../logger/model_loggerupdatecontract.go | 8 + .../logger/model_loggerupdateparameters.go | 11 + .../2021-08-01/logger/predicates.go | 27 + .../2021-08-01/logger/version.go | 12 + .../2021-08-01/namedvalue/README.md | 147 + .../2021-08-01/namedvalue/client.go | 26 + .../2021-08-01/namedvalue/id_namedvalue.go | 140 + .../2021-08-01/namedvalue/id_service.go | 127 + .../namedvalue/method_createorupdate.go | 103 + .../2021-08-01/namedvalue/method_delete.go | 76 + .../2021-08-01/namedvalue/method_get.go | 51 + .../namedvalue/method_getentitytag.go | 46 + .../namedvalue/method_listbyservice.go | 129 + .../2021-08-01/namedvalue/method_listvalue.go | 52 + .../namedvalue/method_refreshsecret.go | 70 + .../2021-08-01/namedvalue/method_update.go | 102 + .../model_keyvaultcontractcreateproperties.go | 9 + .../model_keyvaultcontractproperties.go | 10 + ...vaultlastaccessstatuscontractproperties.go | 28 + .../namedvalue/model_namedvaluecontract.go | 11 + .../model_namedvaluecontractproperties.go | 12 + .../model_namedvaluecreatecontract.go | 11 + ...odel_namedvaluecreatecontractproperties.go | 12 + .../model_namedvaluesecretcontract.go | 8 + ...del_namedvalueupdateparameterproperties.go | 12 + .../model_namedvalueupdateparameters.go | 8 + .../2021-08-01/namedvalue/predicates.go | 27 + .../2021-08-01/namedvalue/version.go | 12 + .../notificationrecipientemail/README.md | 84 + .../notificationrecipientemail/client.go | 26 + .../notificationrecipientemail/constants.go | 66 + .../id_notification.go | 156 + .../id_recipientemail.go | 169 + .../method_checkentityexists.go | 46 + .../method_createorupdate.go | 52 + .../method_delete.go | 47 + .../method_listbynotification.go | 52 + .../model_recipientemailcollection.go | 10 + .../model_recipientemailcontract.go | 11 + .../model_recipientemailcontractproperties.go | 8 + .../notificationrecipientemail/version.go | 12 + .../notificationrecipientuser/README.md | 84 + .../notificationrecipientuser/client.go | 26 + .../notificationrecipientuser/constants.go | 66 + .../id_notification.go | 156 + .../id_recipientuser.go | 169 + .../method_checkentityexists.go | 46 + .../method_createorupdate.go | 52 + .../method_delete.go | 47 + .../method_listbynotification.go | 52 + .../model_recipientusercollection.go | 10 + .../model_recipientusercontract.go | 11 + .../model_recipientuserscontractproperties.go | 8 + .../notificationrecipientuser/version.go | 12 + .../openidconnectprovider/README.md | 143 + .../openidconnectprovider/client.go | 26 + .../id_openidconnectprovider.go | 140 + .../openidconnectprovider/id_service.go | 127 + .../method_createorupdate.go | 85 + .../openidconnectprovider/method_delete.go | 76 + .../openidconnectprovider/method_get.go | 51 + .../method_getentitytag.go | 46 + .../method_listbyservice.go | 125 + .../method_listsecrets.go | 52 + .../openidconnectprovider/method_update.go | 84 + .../model_clientsecretcontract.go | 8 + .../model_openidconnectprovidercontract.go | 11 + ...openidconnectprovidercontractproperties.go | 12 + ...del_openidconnectproviderupdatecontract.go | 8 + ...connectproviderupdatecontractproperties.go | 12 + .../openidconnectprovider/predicates.go | 27 + .../openidconnectprovider/version.go | 12 + .../apimanagement/2021-08-01/policy/README.md | 105 + .../apimanagement/2021-08-01/policy/client.go | 26 + .../2021-08-01/policy/constants.go | 98 + .../2021-08-01/policy/id_service.go | 127 + .../policy/method_createorupdate.go | 85 + .../2021-08-01/policy/method_delete.go | 76 + .../2021-08-01/policy/method_get.go | 80 + .../2021-08-01/policy/method_getentitytag.go | 47 + .../2021-08-01/policy/method_listbyservice.go | 52 + .../policy/model_policycollection.go | 10 + .../2021-08-01/policy/model_policycontract.go | 11 + .../policy/model_policycontractproperties.go | 9 + .../2021-08-01/policy/version.go | 12 + .../2021-08-01/product/README.md | 127 + .../2021-08-01/product/client.go | 26 + .../2021-08-01/product/constants.go | 51 + .../2021-08-01/product/id_product.go | 140 + .../2021-08-01/product/id_service.go | 127 + .../product/method_createorupdate.go | 85 + .../2021-08-01/product/method_delete.go | 79 + .../2021-08-01/product/method_get.go | 51 + .../2021-08-01/product/method_getentitytag.go | 46 + .../product/method_listbyservice.go | 133 + .../2021-08-01/product/method_update.go | 84 + .../product/model_productcontract.go | 11 + .../model_productcontractproperties.go | 14 + .../product/model_productupdateparameters.go | 8 + .../product/model_productupdateproperties.go | 14 + .../2021-08-01/product/predicates.go | 27 + .../2021-08-01/product/version.go | 12 + .../2021-08-01/productapi/README.md | 85 + .../2021-08-01/productapi/client.go | 26 + .../2021-08-01/productapi/constants.go | 189 + .../2021-08-01/productapi/id_product.go | 140 + .../2021-08-01/productapi/id_productapi.go | 153 + .../productapi/method_checkentityexists.go | 46 + .../productapi/method_createorupdate.go | 52 + .../2021-08-01/productapi/method_delete.go | 47 + .../productapi/method_listbyproduct.go | 125 + .../productapi/model_apicontactinformation.go | 10 + .../productapi/model_apicontract.go | 11 + .../productapi/model_apicontractproperties.go | 28 + .../productapi/model_apilicenseinformation.go | 9 + .../model_apiversionsetcontractdetails.go | 13 + .../model_authenticationsettingscontract.go | 9 + ...el_oauth2authenticationsettingscontract.go | 9 + ...el_openidauthenticationsettingscontract.go | 9 + ...l_subscriptionkeyparameternamescontract.go | 9 + .../2021-08-01/productapi/predicates.go | 27 + .../2021-08-01/productapi/version.go | 12 + .../2021-08-01/productgroup/README.md | 85 + .../2021-08-01/productgroup/client.go | 26 + .../2021-08-01/productgroup/constants.go | 54 + .../2021-08-01/productgroup/id_product.go | 140 + .../productgroup/id_productgroup.go | 153 + .../productgroup/method_checkentityexists.go | 46 + .../productgroup/method_createorupdate.go | 52 + .../2021-08-01/productgroup/method_delete.go | 47 + .../productgroup/method_listbyproduct.go | 125 + .../productgroup/model_groupcontract.go | 11 + .../model_groupcontractproperties.go | 12 + .../2021-08-01/productgroup/predicates.go | 27 + .../2021-08-01/productgroup/version.go | 12 + .../2021-08-01/productpolicy/README.md | 105 + .../2021-08-01/productpolicy/client.go | 26 + .../2021-08-01/productpolicy/constants.go | 98 + .../2021-08-01/productpolicy/id_product.go | 140 + .../productpolicy/method_createorupdate.go | 85 + .../2021-08-01/productpolicy/method_delete.go | 76 + .../2021-08-01/productpolicy/method_get.go | 80 + .../productpolicy/method_getentitytag.go | 47 + .../productpolicy/method_listbyproduct.go | 52 + .../productpolicy/model_policycollection.go | 10 + .../productpolicy/model_policycontract.go | 11 + .../model_policycontractproperties.go | 9 + .../2021-08-01/productpolicy/version.go | 12 + .../2021-08-01/producttag/README.md | 101 + .../2021-08-01/producttag/client.go | 26 + .../2021-08-01/producttag/id_product.go | 140 + .../2021-08-01/producttag/id_producttag.go | 153 + .../producttag/method_tagassigntoproduct.go | 52 + .../producttag/method_tagdetachfromproduct.go | 47 + .../producttag/method_taggetbyproduct.go | 51 + .../method_taggetentitystatebyproduct.go | 46 + .../producttag/method_taglistbyproduct.go | 125 + .../producttag/model_tagcontract.go | 11 + .../producttag/model_tagcontractproperties.go | 8 + .../2021-08-01/producttag/predicates.go | 27 + .../2021-08-01/producttag/version.go | 12 + .../2021-08-01/signinsettings/README.md | 94 + .../2021-08-01/signinsettings/client.go | 26 + .../2021-08-01/signinsettings/id_service.go | 127 + .../signinsettings/method_createorupdate.go | 84 + .../2021-08-01/signinsettings/method_get.go | 52 + .../signinsettings/method_getentitytag.go | 47 + .../signinsettings/method_update.go | 79 + .../model_portalsigninsettingproperties.go | 8 + .../model_portalsigninsettings.go | 11 + .../2021-08-01/signinsettings/version.go | 12 + .../2021-08-01/signupsettings/README.md | 94 + .../2021-08-01/signupsettings/client.go | 26 + .../2021-08-01/signupsettings/id_service.go | 127 + .../signupsettings/method_createorupdate.go | 84 + .../2021-08-01/signupsettings/method_get.go | 52 + .../signupsettings/method_getentitytag.go | 47 + .../signupsettings/method_update.go | 79 + .../model_portalsignupsettings.go | 11 + .../model_portalsignupsettingsproperties.go | 9 + .../model_termsofserviceproperties.go | 10 + .../2021-08-01/signupsettings/version.go | 12 + .../2021-08-01/subscription/README.md | 191 + .../2021-08-01/subscription/client.go | 26 + .../2021-08-01/subscription/constants.go | 104 + .../2021-08-01/subscription/id_service.go | 127 + .../subscription/id_subscriptions2.go | 140 + .../subscription/id_usersubscriptions2.go | 153 + .../subscription/method_createorupdate.go | 92 + .../2021-08-01/subscription/method_delete.go | 76 + .../2021-08-01/subscription/method_get.go | 51 + .../subscription/method_getentitytag.go | 46 + .../2021-08-01/subscription/method_list.go | 125 + .../subscription/method_listsecrets.go | 52 + .../method_regenerateprimarykey.go | 47 + .../method_regeneratesecondarykey.go | 47 + .../2021-08-01/subscription/method_update.go | 91 + .../method_usersubscriptionget.go | 51 + .../model_subscriptioncontract.go | 11 + .../model_subscriptioncontractproperties.go | 86 + ...l_subscriptioncreateparameterproperties.go | 14 + .../model_subscriptioncreateparameters.go | 8 + .../model_subscriptionkeyscontract.go | 9 + ...l_subscriptionupdateparameterproperties.go | 34 + .../model_subscriptionupdateparameters.go | 8 + .../2021-08-01/subscription/predicates.go | 27 + .../2021-08-01/subscription/version.go | 12 + .../apimanagement/2021-08-01/tag/README.md | 127 + .../apimanagement/2021-08-01/tag/client.go | 26 + .../2021-08-01/tag/id_service.go | 127 + .../apimanagement/2021-08-01/tag/id_tag.go | 140 + .../2021-08-01/tag/method_createorupdate.go | 85 + .../2021-08-01/tag/method_delete.go | 76 + .../2021-08-01/tag/method_get.go | 51 + .../2021-08-01/tag/method_getentitystate.go | 46 + .../2021-08-01/tag/method_listbyservice.go | 129 + .../2021-08-01/tag/method_update.go | 84 + .../2021-08-01/tag/model_tagcontract.go | 11 + .../tag/model_tagcontractproperties.go | 8 + .../tag/model_tagcreateupdateparameters.go | 8 + .../2021-08-01/tag/predicates.go | 27 + .../apimanagement/2021-08-01/tag/version.go | 12 + .../2021-08-01/tenantaccess/README.md | 159 + .../2021-08-01/tenantaccess/client.go | 26 + .../2021-08-01/tenantaccess/constants.go | 51 + .../2021-08-01/tenantaccess/id_access.go | 156 + .../2021-08-01/tenantaccess/id_service.go | 127 + .../2021-08-01/tenantaccess/method_create.go | 84 + .../2021-08-01/tenantaccess/method_get.go | 51 + .../tenantaccess/method_getentitytag.go | 46 + .../tenantaccess/method_listbyservice.go | 117 + .../tenantaccess/method_listsecrets.go | 52 + .../method_regenerateprimarykey.go | 47 + .../method_regeneratesecondarykey.go | 47 + .../2021-08-01/tenantaccess/method_update.go | 84 + .../model_accessinformationcontract.go | 11 + ...del_accessinformationcontractproperties.go | 10 + ...essinformationcreateparameterproperties.go | 11 + ...model_accessinformationcreateparameters.go | 8 + .../model_accessinformationsecretscontract.go | 12 + ...essinformationupdateparameterproperties.go | 8 + ...model_accessinformationupdateparameters.go | 8 + .../2021-08-01/tenantaccess/predicates.go | 27 + .../2021-08-01/tenantaccess/version.go | 12 + .../apimanagement/2021-08-01/user/README.md | 127 + .../apimanagement/2021-08-01/user/client.go | 26 + .../2021-08-01/user/constants.go | 183 + .../2021-08-01/user/id_service.go | 127 + .../apimanagement/2021-08-01/user/id_user.go | 140 + .../2021-08-01/user/method_createorupdate.go | 88 + .../2021-08-01/user/method_delete.go | 87 + .../2021-08-01/user/method_get.go | 51 + .../2021-08-01/user/method_getentitytag.go | 46 + .../2021-08-01/user/method_listbyservice.go | 129 + .../2021-08-01/user/method_update.go | 84 + .../user/model_groupcontractproperties.go | 12 + .../2021-08-01/user/model_usercontract.go | 11 + .../user/model_usercontractproperties.go | 33 + .../model_usercreateparameterproperties.go | 16 + .../user/model_usercreateparameters.go | 8 + .../user/model_useridentitycontract.go | 9 + .../user/model_userupdateparameters.go | 8 + .../model_userupdateparametersproperties.go | 14 + .../2021-08-01/user/predicates.go | 27 + .../apimanagement/2021-08-01/user/version.go | 12 + vendor/modules.txt | 46 +- 947 files changed, 47103 insertions(+), 59902 deletions(-) create mode 100644 internal/services/apimanagement/migration/api_operation_policy_v0_to_v1.go create mode 100644 internal/services/apimanagement/migration/api_policy_v0_to_v1.go create mode 100644 internal/services/apimanagement/migration/api_product_policy_v0_to_v1.go create mode 100644 internal/services/apimanagement/migration/policy_v1_to_v2.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/CHANGELOG.md delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/_meta.json delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/api.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apidiagnostic.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiexport.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiissue.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiissueattachment.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiissuecomment.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apioperation.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apioperationpolicy.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apipolicy.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiproduct.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apirelease.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apirevision.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apischema.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apitagdescription.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiversionset.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/authorizationserver.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/backend.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/cache.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/certificate.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/client.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/contentitem.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/contenttype.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/delegationsettings.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/deletedservices.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/diagnostic.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/emailtemplate.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/enums.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gateway.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gatewayapi.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gatewaycertificateauthority.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gatewayhostnameconfiguration.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/group.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/groupuser.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/identityprovider.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/issue.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/logger.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/models.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/namedvalue.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/networkstatus.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/notification.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/notificationrecipientemail.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/notificationrecipientuser.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/openidconnectprovider.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/operation.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/operations.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/outboundnetworkdependenciesendpoints.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/policy.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/policydescription.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/portalrevision.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/portalsettings.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/privateendpointconnection.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/product.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productapi.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productgroup.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productpolicy.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productsubscriptions.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/quotabycounterkeys.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/quotabyperiodkeys.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/region.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/reports.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/service.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/serviceskus.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/signinsettings.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/signupsettings.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/skus.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/subscription.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tag.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tagresource.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantaccess.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantaccessgit.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantconfiguration.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantsettings.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/user.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/userconfirmationpassword.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/usergroup.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/useridentities.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/usersubscription.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/id_api.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontactinformation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontractupdateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicreateorupdateparameter.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicreateorupdateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicreateorupdatepropertieswsdlselector.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apilicenseinformation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apiupdatecontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apiversionsetcontractdetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_authenticationsettingscontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_oauth2authenticationsettingscontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_openidauthenticationsettingscontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_subscriptionkeyparameternamescontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_api.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_apidiagnostic.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_bodydiagnosticsettings.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_datamasking.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_datamaskingentity.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_diagnosticcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_diagnosticcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_httpmessagediagnostic.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_pipelinediagnosticsettings.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_samplingsettings.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_applynetworkconfigurationupdates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_backup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_checknameavailability.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getdomainownershipidentifier.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getssotoken.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_listbyresourcegroup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_restore.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_additionallocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceapplynetworkconfigurationparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicebackuprestoreparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicechecknameavailabilityparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicegetdomainownershipidentifierresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicegetssotokenresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicenameavailabilityresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceresource.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceskuproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceupdateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apiversionconstraint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_armidwrapper.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_certificateconfiguration.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_certificateinformation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_hostnameconfiguration.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_privateendpointconnectionwrapperproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_privatelinkserviceconnectionstate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_remoteprivateendpointconnectionwrapper.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_virtualnetworkconfiguration.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/id_api.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/id_operation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_listbyapi.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationupdatecontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationupdatecontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_parametercontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_parameterexamplecontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_representationcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_requestcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_responsecontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/id_operation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_listbyoperation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/model_policycollection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/model_policycontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/model_policycontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operationtag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagassigntooperation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagdetachfromoperation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetbyoperation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetentitystatebyoperation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taglistbyoperation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/model_tagcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/model_tagcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/id_api.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_listbyapi.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/model_policycollection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/model_policycontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/model_policycontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/id_api.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/id_release.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/model_apireleasecontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/model_apireleasecontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/id_api.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/id_apischema.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_listbyapi.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/model_schemacontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/model_schemacontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/model_schemadocumentproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/id_api.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/id_apitag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_tagassigntoapi.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_tagdetachfromapi.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_taggetbyapi.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_taggetentitystatebyapi.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_taglistbyapi.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/model_tagcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/model_tagcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/id_api.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/id_tagdescription.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptionbaseproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptioncontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptioncontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptioncreateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/id_apiversionset.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetupdateparametersproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/id_apiversionset.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/method_apiversionsetdelete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/id_authorizationserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listsecrets.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationservercontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationservercontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationserversecretscontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationserverupdatecontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationserverupdatecontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_tokenbodyparametercontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/id_backend.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendauthorizationheadercredentials.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendcredentialscontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendproxycontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendservicefabricclusterproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendtlsproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendupdateparameterproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_x509certificatename.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/id_cache.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cachecontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cachecontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cacheupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cacheupdateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/id_certificate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_refreshsecret.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecreateorupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecreateorupdateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_keyvaultcontractcreateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_keyvaultcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_keyvaultlastaccessstatuscontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_listsecrets.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_portaldelegationsettings.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_portaldelegationsettingsproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_portalsettingvalidationkeycontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_registrationdelegationsettingsproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_subscriptionsdelegationsettingsproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/id_deletedservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/method_getbyname.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/method_listbysubscription.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/method_purge.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/model_deletedservicecontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/model_deletedservicecontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/id_diagnostic.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_bodydiagnosticsettings.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_datamasking.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_datamaskingentity.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_diagnosticcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_diagnosticcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_httpmessagediagnostic.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_pipelinediagnosticsettings.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_samplingsettings.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/id_template.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatecreateorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatedelete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateget.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplategetentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplatecontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplatecontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplateparameterscontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplateupdateparameterproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplateupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/id_gateway.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/model_gatewaycontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/model_gatewaycontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/model_resourcelocationdatacontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gateway.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gatewayapi.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apicontactinformation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apicontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apicontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apilicenseinformation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apiversionsetcontractdetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_associationcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_associationcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_authenticationsettingscontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_oauth2authenticationsettingscontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_openidauthenticationsettingscontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_subscriptionkeyparameternamescontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_certificateauthority.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_gateway.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/model_gatewaycertificateauthoritycontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/model_gatewaycertificateauthoritycontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_gateway.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_hostnameconfiguration.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/model_gatewayhostnameconfigurationcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/model_gatewayhostnameconfigurationcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/id_group.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcreateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcreateparametersproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupupdateparametersproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/id_group.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/id_groupuser.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_checkentityexists.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_create.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_groupcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_usercontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_usercontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_useridentitycontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/id_identityprovider.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_listsecrets.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_clientsecretcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercreatecontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercreatecontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityproviderupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityproviderupdateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/id_logger.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggercontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggercontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggerupdatecontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggerupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/id_namedvalue.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_listvalue.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_refreshsecret.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_keyvaultcontractcreateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_keyvaultcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_keyvaultlastaccessstatuscontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecreatecontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecreatecontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluesecretcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvalueupdateparameterproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvalueupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_notification.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_recipientemail.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_checkentityexists.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_listbynotification.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/model_recipientemailcollection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/model_recipientemailcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/model_recipientemailcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_notification.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_recipientuser.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_checkentityexists.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_listbynotification.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/model_recipientusercollection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/model_recipientusercontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/model_recipientuserscontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_openidconnectprovider.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listsecrets.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_clientsecretcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectprovidercontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectprovidercontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectproviderupdatecontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectproviderupdatecontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/model_policycollection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/model_policycontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/model_policycontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/id_product.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productupdateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/id_product.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/id_productapi.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_checkentityexists.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_listbyproduct.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apicontactinformation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apicontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apicontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apilicenseinformation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apiversionsetcontractdetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_authenticationsettingscontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_oauth2authenticationsettingscontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_openidauthenticationsettingscontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_subscriptionkeyparameternamescontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/id_product.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/id_productgroup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_checkentityexists.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_listbyproduct.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/model_groupcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/model_groupcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/id_product.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_listbyproduct.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/model_policycollection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/model_policycontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/model_policycontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/id_product.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/id_producttag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_tagassigntoproduct.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_tagdetachfromproduct.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_taggetbyproduct.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_taggetentitystatebyproduct.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_taglistbyproduct.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/model_tagcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/model_tagcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/model_portalsigninsettingproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/model_portalsigninsettings.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/model_portalsignupsettings.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/model_portalsignupsettingsproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/model_termsofserviceproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/id_subscriptions2.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/id_usersubscriptions2.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_listsecrets.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_regenerateprimarykey.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_regeneratesecondarykey.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_usersubscriptionget.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncreateparameterproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncreateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptionkeyscontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptionupdateparameterproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptionupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/id_tag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_getentitystate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/model_tagcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/model_tagcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/model_tagcreateupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/id_access.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_create.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listsecrets.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regenerateprimarykey.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regeneratesecondarykey.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcreateparameterproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcreateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationsecretscontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationupdateparameterproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/id_service.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/id_user.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_getentitytag.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_listbyservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_groupcontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercontractproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercreateparameterproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercreateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_useridentitycontract.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_userupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_userupdateparametersproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/version.go diff --git a/internal/services/apimanagement/api_management_api_data_source.go b/internal/services/apimanagement/api_management_api_data_source.go index c4c160bf5804..fd26a8dbfc8f 100644 --- a/internal/services/apimanagement/api_management_api_data_source.go +++ b/internal/services/apimanagement/api_management_api_data_source.go @@ -7,16 +7,16 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceApiManagementApi() *pluginsdk.Resource { @@ -129,50 +129,48 @@ func dataSourceApiManagementApiRead(d *pluginsdk.ResourceData, meta interface{}) defer cancel() revision := d.Get("revision").(string) - id := parse.NewApiID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) + apiId := fmt.Sprintf("%s;rev=%s", d.Get("name").(string), revision) - apiId := fmt.Sprintf("%s;rev=%s", id.Name, revision) - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, apiId) + id := api.NewApiID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), apiId) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf("api %s Revision %q does not exist", id, revision) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s does not exist", id) } - - return fmt.Errorf("retrieving API %s / Revision %q : %+v", id, revision, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) d.Set("api_management_name", id.ServiceName) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - - if props := resp.APIContractProperties; props != nil { - d.Set("description", props.Description) - d.Set("display_name", props.DisplayName) - d.Set("is_current", props.IsCurrent) - d.Set("is_online", props.IsOnline) - d.Set("path", props.Path) - d.Set("revision", props.APIRevision) - d.Set("service_url", props.ServiceURL) - d.Set("soap_pass_through", string(props.APIType) == string(apimanagement.SoapAPITypeSoapPassThrough)) - d.Set("subscription_required", props.SubscriptionRequired) - d.Set("version", props.APIVersion) - d.Set("version_set_id", props.APIVersionSetID) - - if err := d.Set("protocols", flattenApiManagementApiDataSourceProtocols(props.Protocols)); err != nil { + name := getApiName(id.ApiId) + d.Set("name", name) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("description", pointer.From(model.Properties.Description)) + d.Set("display_name", pointer.From(model.Properties.DisplayName)) + d.Set("is_current", pointer.From(model.Properties.IsCurrent)) + d.Set("is_online", pointer.From(model.Properties.IsOnline)) + d.Set("path", model.Properties.Path) + d.Set("revision", pointer.From(model.Properties.ApiRevision)) + d.Set("service_url", pointer.From(model.Properties.ServiceUrl)) + d.Set("soap_pass_through", pointer.From(model.Properties.Type) == api.ApiTypeSoap) + d.Set("subscription_required", pointer.From(model.Properties.SubscriptionRequired)) + d.Set("version", pointer.From(model.Properties.ApiVersion)) + d.Set("version_set_id", pointer.From(model.Properties.ApiVersionSetId)) + if err := d.Set("protocols", flattenApiManagementApiDataSourceProtocols(model.Properties.Protocols)); err != nil { return fmt.Errorf("setting `protocols`: %s", err) } - if err := d.Set("subscription_key_parameter_names", flattenApiManagementApiDataSourceSubscriptionKeyParamNames(props.SubscriptionKeyParameterNames)); err != nil { + if err := d.Set("subscription_key_parameter_names", flattenApiManagementApiDataSourceSubscriptionKeyParamNames(model.Properties.SubscriptionKeyParameterNames)); err != nil { return fmt.Errorf("setting `subscription_key_parameter_names`: %+v", err) } } - return nil } -func flattenApiManagementApiDataSourceProtocols(input *[]apimanagement.Protocol) []string { +func flattenApiManagementApiDataSourceProtocols(input *[]api.Protocol) []string { if input == nil { return []string{} } @@ -185,20 +183,15 @@ func flattenApiManagementApiDataSourceProtocols(input *[]apimanagement.Protocol) return results } -func flattenApiManagementApiDataSourceSubscriptionKeyParamNames(paramNames *apimanagement.SubscriptionKeyParameterNamesContract) []interface{} { +func flattenApiManagementApiDataSourceSubscriptionKeyParamNames(paramNames *api.SubscriptionKeyParameterNamesContract) []interface{} { if paramNames == nil { return make([]interface{}, 0) } result := make(map[string]interface{}) - if paramNames.Header != nil { - result["header"] = *paramNames.Header - } - - if paramNames.Query != nil { - result["query"] = *paramNames.Query - } + result["header"] = pointer.From(paramNames.Header) + result["query"] = pointer.From(paramNames.Query) return []interface{}{result} } diff --git a/internal/services/apimanagement/api_management_api_diagnostic_resource.go b/internal/services/apimanagement/api_management_api_diagnostic_resource.go index 31ac8cd725ce..eba3eea11326 100644 --- a/internal/services/apimanagement/api_management_api_diagnostic_resource.go +++ b/internal/services/apimanagement/api_management_api_diagnostic_resource.go @@ -8,18 +8,18 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/set" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementApiDiagnostic() *pluginsdk.Resource { @@ -30,7 +30,7 @@ func resourceApiManagementApiDiagnostic() *pluginsdk.Resource { Delete: resourceApiManagementApiDiagnosticDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApiDiagnosticID(id) + _, err := apidiagnostic.ParseApiDiagnosticID(id) return err }), @@ -61,7 +61,7 @@ func resourceApiManagementApiDiagnostic() *pluginsdk.Resource { "api_management_logger_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validate.LoggerID, + ValidateFunc: logger.ValidateLoggerID, }, "sampling_percentage": { @@ -82,9 +82,9 @@ func resourceApiManagementApiDiagnostic() *pluginsdk.Resource { Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.VerbosityVerbose), - string(apimanagement.VerbosityInformation), - string(apimanagement.VerbosityError), + string(apidiagnostic.VerbosityVerbose), + string(apidiagnostic.VerbosityInformation), + string(apidiagnostic.VerbosityError), }, false), }, @@ -99,9 +99,9 @@ func resourceApiManagementApiDiagnostic() *pluginsdk.Resource { Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.HTTPCorrelationProtocolNone), - string(apimanagement.HTTPCorrelationProtocolLegacy), - string(apimanagement.HTTPCorrelationProtocolW3C), + string(apidiagnostic.HTTPCorrelationProtocolNone), + string(apidiagnostic.HTTPCorrelationProtocolLegacy), + string(apidiagnostic.HTTPCorrelationProtocolWThreeC), }, false), }, @@ -116,10 +116,10 @@ func resourceApiManagementApiDiagnostic() *pluginsdk.Resource { "operation_name_format": { Type: pluginsdk.TypeString, Optional: true, - Default: string(apimanagement.OperationNameFormatName), + Default: string(apidiagnostic.OperationNameFormatName), ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.OperationNameFormatName), - string(apimanagement.OperationNameFormatURL), + string(apidiagnostic.OperationNameFormatName), + string(apidiagnostic.OperationNameFormatUrl), }, false), }, }, @@ -170,88 +170,88 @@ func resourceApiManagementApiDiagnosticCreateUpdate(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewApiDiagnosticID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("api_name").(string), d.Get("identifier").(string)) + id := apidiagnostic.NewApiDiagnosticID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("api_name").(string), d.Get("identifier").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.DiagnosticName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing Diagnostic %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_api_diagnostic", id.ID()) } } - parameters := apimanagement.DiagnosticContract{ - DiagnosticContractProperties: &apimanagement.DiagnosticContractProperties{ - LoggerID: utils.String(d.Get("api_management_logger_id").(string)), - OperationNameFormat: apimanagement.OperationNameFormat(d.Get("operation_name_format").(string)), + parameters := apidiagnostic.DiagnosticContract{ + Properties: &apidiagnostic.DiagnosticContractProperties{ + LoggerId: d.Get("api_management_logger_id").(string), + OperationNameFormat: pointer.To(apidiagnostic.OperationNameFormat(d.Get("operation_name_format").(string))), }, } samplingPercentage := d.GetRawConfig().AsValueMap()["sampling_percentage"] if !samplingPercentage.IsNull() { - parameters.Sampling = &apimanagement.SamplingSettings{ - SamplingType: apimanagement.SamplingTypeFixed, - Percentage: utils.Float(d.Get("sampling_percentage").(float64)), + parameters.Properties.Sampling = &apidiagnostic.SamplingSettings{ + SamplingType: pointer.To(apidiagnostic.SamplingTypeFixed), + Percentage: pointer.To(d.Get("sampling_percentage").(float64)), } } else { - parameters.Sampling = nil + parameters.Properties.Sampling = nil } if alwaysLogErrors, ok := d.GetOk("always_log_errors"); ok && alwaysLogErrors.(bool) { - parameters.AlwaysLog = apimanagement.AlwaysLogAllErrors + parameters.Properties.AlwaysLog = pointer.To(apidiagnostic.AlwaysLogAllErrors) } if verbosity, ok := d.GetOk("verbosity"); ok { - parameters.Verbosity = apimanagement.Verbosity(verbosity.(string)) + parameters.Properties.Verbosity = pointer.To(apidiagnostic.Verbosity(verbosity.(string))) } //lint:ignore SA1019 SDKv2 migration - staticcheck's own linter directives are currently being ignored under golanci-lint if logClientIP, exists := d.GetOkExists("log_client_ip"); exists { //nolint:staticcheck - parameters.LogClientIP = utils.Bool(logClientIP.(bool)) + parameters.Properties.LogClientIP = pointer.To(logClientIP.(bool)) } if httpCorrelationProtocol, ok := d.GetOk("http_correlation_protocol"); ok { - parameters.HTTPCorrelationProtocol = apimanagement.HTTPCorrelationProtocol(httpCorrelationProtocol.(string)) + parameters.Properties.HTTPCorrelationProtocol = pointer.To(apidiagnostic.HTTPCorrelationProtocol(httpCorrelationProtocol.(string))) } frontendRequest, frontendRequestSet := d.GetOk("frontend_request") frontendResponse, frontendResponseSet := d.GetOk("frontend_response") if frontendRequestSet || frontendResponseSet { - parameters.Frontend = &apimanagement.PipelineDiagnosticSettings{} + parameters.Properties.Frontend = &apidiagnostic.PipelineDiagnosticSettings{} if frontendRequestSet { - parameters.Frontend.Request = expandApiManagementApiDiagnosticHTTPMessageDiagnostic(frontendRequest.([]interface{})) + parameters.Properties.Frontend.Request = expandApiManagementApiDiagnosticHTTPMessageDiagnostic(frontendRequest.([]interface{})) } if frontendResponseSet { - parameters.Frontend.Response = expandApiManagementApiDiagnosticHTTPMessageDiagnostic(frontendResponse.([]interface{})) + parameters.Properties.Frontend.Response = expandApiManagementApiDiagnosticHTTPMessageDiagnostic(frontendResponse.([]interface{})) } } backendRequest, backendRequestSet := d.GetOk("backend_request") backendResponse, backendResponseSet := d.GetOk("backend_response") if backendRequestSet || backendResponseSet { - parameters.Backend = &apimanagement.PipelineDiagnosticSettings{} + parameters.Properties.Backend = &apidiagnostic.PipelineDiagnosticSettings{} if backendRequestSet { - parameters.Backend.Request = expandApiManagementApiDiagnosticHTTPMessageDiagnostic(backendRequest.([]interface{})) + parameters.Properties.Backend.Request = expandApiManagementApiDiagnosticHTTPMessageDiagnostic(backendRequest.([]interface{})) } if backendResponseSet { - parameters.Backend.Response = expandApiManagementApiDiagnosticHTTPMessageDiagnostic(backendResponse.([]interface{})) + parameters.Properties.Backend.Response = expandApiManagementApiDiagnosticHTTPMessageDiagnostic(backendResponse.([]interface{})) } } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.DiagnosticName, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, apidiagnostic.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating or updating Diagnostic %s: %+v", id, err) } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.DiagnosticName) + resp, err := client.Get(ctx, id) if err != nil { return fmt.Errorf("retrieving Diagnostic %s: %+v", id, err) } - if resp.ID == nil || *resp.ID == "" { + if resp.Model != nil && pointer.From(resp.Model.Id) == "" { return fmt.Errorf("reading ID for Diagnostic %s: ID is empty", id) } d.SetId(id.ID()) @@ -264,55 +264,59 @@ func resourceApiManagementApiDiagnosticRead(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - diagnosticId, err := parse.ApiDiagnosticID(d.Id()) + diagnosticId, err := apidiagnostic.ParseApiDiagnosticID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, diagnosticId.ResourceGroup, diagnosticId.ServiceName, diagnosticId.ApiName, diagnosticId.DiagnosticName) + apiName := getApiName(diagnosticId.ApiId) + + newId := apidiagnostic.NewApiDiagnosticID(diagnosticId.SubscriptionId, diagnosticId.ResourceGroupName, diagnosticId.ServiceName, apiName, diagnosticId.DiagnosticId) + resp, err := client.Get(ctx, newId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Diagnostic %q (Resource Group %q / API Management Service %q / API %q) was not found - removing from state!", diagnosticId.DiagnosticName, diagnosticId.ResourceGroup, diagnosticId.ServiceName, diagnosticId.ApiName) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", newId) d.SetId("") return nil } - return fmt.Errorf("making Read request for Diagnostic %q (Resource Group %q / API Management Service %q / API %q): %+v", diagnosticId.DiagnosticName, diagnosticId.ResourceGroup, diagnosticId.ServiceName, diagnosticId.ApiName, err) + return fmt.Errorf("retrieving %s: %+v", newId, err) } - - d.Set("api_name", diagnosticId.ApiName) - d.Set("identifier", resp.Name) - d.Set("resource_group_name", diagnosticId.ResourceGroup) + d.Set("api_name", apiName) + d.Set("resource_group_name", diagnosticId.ResourceGroupName) d.Set("api_management_name", diagnosticId.ServiceName) - if props := resp.DiagnosticContractProperties; props != nil { - d.Set("api_management_logger_id", props.LoggerID) - if props.Sampling != nil && props.Sampling.Percentage != nil { - d.Set("sampling_percentage", props.Sampling.Percentage) - } - d.Set("always_log_errors", props.AlwaysLog == apimanagement.AlwaysLogAllErrors) - d.Set("verbosity", props.Verbosity) - d.Set("log_client_ip", props.LogClientIP) - d.Set("http_correlation_protocol", props.HTTPCorrelationProtocol) - if frontend := props.Frontend; frontend != nil { - d.Set("frontend_request", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(frontend.Request)) - d.Set("frontend_response", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(frontend.Response)) - } else { - d.Set("frontend_request", nil) - d.Set("frontend_response", nil) - } - if backend := props.Backend; backend != nil { - d.Set("backend_request", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(backend.Request)) - d.Set("backend_response", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(backend.Response)) - } else { - d.Set("backend_request", nil) - d.Set("backend_response", nil) - } + if model := resp.Model; model != nil { + d.Set("identifier", pointer.From(model.Name)) + if model.Properties != nil { + d.Set("api_management_logger_id", model.Properties.LoggerId) + if model.Properties.Sampling != nil && model.Properties.Sampling.Percentage != nil { + d.Set("sampling_percentage", pointer.From(model.Properties.Sampling.Percentage)) + } + d.Set("always_log_errors", pointer.From(model.Properties.AlwaysLog) == apidiagnostic.AlwaysLogAllErrors) + d.Set("verbosity", pointer.From(model.Properties.Verbosity)) + d.Set("log_client_ip", pointer.From(model.Properties.LogClientIP)) + d.Set("http_correlation_protocol", pointer.From(model.Properties.HTTPCorrelationProtocol)) + if frontend := model.Properties.Frontend; frontend != nil { + d.Set("frontend_request", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(frontend.Request)) + d.Set("frontend_response", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(frontend.Response)) + } else { + d.Set("frontend_request", nil) + d.Set("frontend_response", nil) + } + if backend := model.Properties.Backend; backend != nil { + d.Set("backend_request", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(backend.Request)) + d.Set("backend_response", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(backend.Response)) + } else { + d.Set("backend_request", nil) + d.Set("backend_response", nil) + } - format := string(apimanagement.OperationNameFormatName) - if props.OperationNameFormat != "" { - format = string(props.OperationNameFormat) + format := string(apidiagnostic.OperationNameFormatName) + if model.Properties.OperationNameFormat != nil { + format = string(pointer.From(model.Properties.OperationNameFormat)) + } + d.Set("operation_name_format", format) } - d.Set("operation_name_format", format) } return nil @@ -323,33 +327,36 @@ func resourceApiManagementApiDiagnosticDelete(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - diagnosticId, err := parse.ApiDiagnosticID(d.Id()) + diagnosticId, err := apidiagnostic.ParseApiDiagnosticID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, diagnosticId.ResourceGroup, diagnosticId.ServiceName, diagnosticId.ApiName, diagnosticId.DiagnosticName, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting Diagnostic %q (Resource Group %q / API Management Service %q / API %q): %+v", diagnosticId.DiagnosticName, diagnosticId.ResourceGroup, diagnosticId.ServiceName, diagnosticId.ApiName, err) + name := getApiName(diagnosticId.ApiId) + + newId := apidiagnostic.NewApiDiagnosticID(diagnosticId.SubscriptionId, diagnosticId.ResourceGroupName, diagnosticId.ServiceName, name, diagnosticId.DiagnosticId) + if resp, err := client.Delete(ctx, newId, apidiagnostic.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", newId, err) } } return nil } -func expandApiManagementApiDiagnosticHTTPMessageDiagnostic(input []interface{}) *apimanagement.HTTPMessageDiagnostic { +func expandApiManagementApiDiagnosticHTTPMessageDiagnostic(input []interface{}) *apidiagnostic.HTTPMessageDiagnostic { if len(input) == 0 || input[0] == nil { return nil } v := input[0].(map[string]interface{}) - result := &apimanagement.HTTPMessageDiagnostic{ - Body: &apimanagement.BodyDiagnosticSettings{}, + result := &apidiagnostic.HTTPMessageDiagnostic{ + Body: &apidiagnostic.BodyDiagnosticSettings{}, } if bodyBytes, ok := v["body_bytes"]; ok { - result.Body.Bytes = utils.Int32(int32(bodyBytes.(int))) + result.Body.Bytes = pointer.To(int64(bodyBytes.(int))) } if headersSetRaw, ok := v["headers_to_log"]; ok { headersSet := headersSetRaw.(*pluginsdk.Set).List() @@ -357,15 +364,15 @@ func expandApiManagementApiDiagnosticHTTPMessageDiagnostic(input []interface{}) for _, header := range headersSet { headers = append(headers, header.(string)) } - result.Headers = &headers + result.Headers = pointer.To(headers) } - result.DataMasking = expandApiManagementDataMasking(v["data_masking"].([]interface{})) + result.DataMasking = expandApiManagementApiDiagnosticDataMasking(v["data_masking"].([]interface{})) return result } -func flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(input *apimanagement.HTTPMessageDiagnostic) []interface{} { +func flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(input *apidiagnostic.HTTPMessageDiagnostic) []interface{} { result := make([]interface{}, 0) if input == nil { @@ -375,14 +382,14 @@ func flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(input *apimanagement diagnostic := map[string]interface{}{} if input.Body != nil && input.Body.Bytes != nil { - diagnostic["body_bytes"] = input.Body.Bytes + diagnostic["body_bytes"] = pointer.From(input.Body.Bytes) } if input.Headers != nil { diagnostic["headers_to_log"] = set.FromStringSlice(*input.Headers) } - diagnostic["data_masking"] = flattenApiManagementDataMasking(input.DataMasking) + diagnostic["data_masking"] = flattenApiManagementApiDiagnosticDataMasking(input.DataMasking) result = append(result, diagnostic) @@ -399,8 +406,8 @@ func schemaApiManagementDataMaskingEntityList() *pluginsdk.Schema { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.DataMaskingModeHide), - string(apimanagement.DataMaskingModeMask), + string(apidiagnostic.DataMaskingModeHide), + string(apidiagnostic.DataMaskingModeMask), }, false), }, @@ -414,45 +421,45 @@ func schemaApiManagementDataMaskingEntityList() *pluginsdk.Schema { } } -func expandApiManagementDataMasking(input []interface{}) *apimanagement.DataMasking { +func expandApiManagementApiDiagnosticDataMasking(input []interface{}) *apidiagnostic.DataMasking { if len(input) == 0 || input[0] == nil { return nil } inputRaw := input[0].(map[string]interface{}) - return &apimanagement.DataMasking{ - QueryParams: expandApiManagementDataMaskingEntityList(inputRaw["query_params"].([]interface{})), - Headers: expandApiManagementDataMaskingEntityList(inputRaw["headers"].([]interface{})), + return &apidiagnostic.DataMasking{ + QueryParams: expandApiManagementApiDiagnosticDataMaskingEntityList(inputRaw["query_params"].([]interface{})), + Headers: expandApiManagementApiDiagnosticDataMaskingEntityList(inputRaw["headers"].([]interface{})), } } -func expandApiManagementDataMaskingEntityList(input []interface{}) *[]apimanagement.DataMaskingEntity { +func expandApiManagementApiDiagnosticDataMaskingEntityList(input []interface{}) *[]apidiagnostic.DataMaskingEntity { if len(input) == 0 || input[0] == nil { return nil } - result := make([]apimanagement.DataMaskingEntity, 0) + result := make([]apidiagnostic.DataMaskingEntity, 0) for _, v := range input { entity := v.(map[string]interface{}) - result = append(result, apimanagement.DataMaskingEntity{ - Mode: apimanagement.DataMaskingMode(entity["mode"].(string)), - Value: utils.String(entity["value"].(string)), + result = append(result, apidiagnostic.DataMaskingEntity{ + Mode: pointer.To(apidiagnostic.DataMaskingMode(entity["mode"].(string))), + Value: pointer.To(entity["value"].(string)), }) } return &result } -func flattenApiManagementDataMasking(dataMasking *apimanagement.DataMasking) []interface{} { +func flattenApiManagementApiDiagnosticDataMasking(dataMasking *apidiagnostic.DataMasking) []interface{} { if dataMasking == nil { return []interface{}{} } var queryParams, headers []interface{} if dataMasking.QueryParams != nil { - queryParams = flattenApiManagementDataMaskingEntityList(dataMasking.QueryParams) + queryParams = flattenApiManagementApiDiagnosticDataMaskingEntityList(dataMasking.QueryParams) } if dataMasking.Headers != nil { - headers = flattenApiManagementDataMaskingEntityList(dataMasking.Headers) + headers = flattenApiManagementApiDiagnosticDataMaskingEntityList(dataMasking.Headers) } return []interface{}{ @@ -463,7 +470,7 @@ func flattenApiManagementDataMasking(dataMasking *apimanagement.DataMasking) []i } } -func flattenApiManagementDataMaskingEntityList(dataMaskingList *[]apimanagement.DataMaskingEntity) []interface{} { +func flattenApiManagementApiDiagnosticDataMaskingEntityList(dataMaskingList *[]apidiagnostic.DataMaskingEntity) []interface{} { if dataMaskingList == nil || len(*dataMaskingList) == 0 { return []interface{}{} } @@ -471,13 +478,9 @@ func flattenApiManagementDataMaskingEntityList(dataMaskingList *[]apimanagement. result := []interface{}{} for _, entity := range *dataMaskingList { - var value string - if entity.Value != nil { - value = *entity.Value - } result = append(result, map[string]interface{}{ - "mode": string(entity.Mode), - "value": value, + "mode": pointer.From(entity.Mode), + "value": pointer.From(entity.Value), }) } diff --git a/internal/services/apimanagement/api_management_api_diagnostic_resource_test.go b/internal/services/apimanagement/api_management_api_diagnostic_resource_test.go index cf88b1c58d9f..8e8aee1bf47a 100644 --- a/internal/services/apimanagement/api_management_api_diagnostic_resource_test.go +++ b/internal/services/apimanagement/api_management_api_diagnostic_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementApiDiagnosticResource struct{} @@ -130,17 +130,17 @@ func TestAccApiManagementApiDiagnostic_dataMasking(t *testing.T) { } func (ApiManagementApiDiagnosticResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApiDiagnosticID(state.ID) + id, err := apidiagnostic.ParseApiDiagnosticID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.ApiDiagnosticClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.DiagnosticName) + resp, err := clients.ApiManagement.ApiDiagnosticClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading ApiManagementApiDiagnostic (%s): %+v", id.String(), err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementApiDiagnosticResource) template(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_api_operation_policy_resource.go b/internal/services/apimanagement/api_management_api_operation_policy_resource.go index 303db07fa485..0743e2225984 100644 --- a/internal/services/apimanagement/api_management_api_operation_policy_resource.go +++ b/internal/services/apimanagement/api_management_api_operation_policy_resource.go @@ -9,15 +9,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementApiOperationPolicy() *pluginsdk.Resource { @@ -27,7 +28,7 @@ func resourceApiManagementApiOperationPolicy() *pluginsdk.Resource { Update: resourceApiManagementAPIOperationPolicyCreateUpdate, Delete: resourceApiManagementAPIOperationPolicyDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApiOperationPolicyID(id) + _, err := apioperationpolicy.ParseOperationID(id) return err }), @@ -38,6 +39,11 @@ func resourceApiManagementApiOperationPolicy() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, + SchemaVersion: 1, + StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ + 0: migration.ApiManagementApiOperationPolicyV0ToV1{}, + }), + Schema: map[string]*pluginsdk.Schema{ "resource_group_name": commonschema.ResourceGroupName(), @@ -70,45 +76,45 @@ func resourceApiManagementAPIOperationPolicyCreateUpdate(d *pluginsdk.ResourceDa ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewApiOperationPolicyID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("api_name").(string), d.Get("operation_id").(string), string(apimanagement.PolicyExportFormatXML)) + id := apioperationpolicy.NewOperationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("api_name").(string), d.Get("operation_id").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.OperationName, apimanagement.PolicyExportFormat(id.PolicyName)) + existing, err := client.Get(ctx, id, apioperationpolicy.GetOperationOptions{Format: pointer.To(apioperationpolicy.PolicyExportFormatXml)}) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_api_operation_policy", id.ID()) } } - parameters := apimanagement.PolicyContract{} + parameters := apioperationpolicy.PolicyContract{} xmlContent := d.Get("xml_content").(string) xmlLink := d.Get("xml_link").(string) if xmlContent != "" { - parameters.PolicyContractProperties = &apimanagement.PolicyContractProperties{ - Format: apimanagement.PolicyContentFormatRawxml, - Value: utils.String(xmlContent), + parameters.Properties = &apioperationpolicy.PolicyContractProperties{ + Format: pointer.To(apioperationpolicy.PolicyContentFormatRawxml), + Value: xmlContent, } } if xmlLink != "" { - parameters.PolicyContractProperties = &apimanagement.PolicyContractProperties{ - Format: apimanagement.PolicyContentFormatRawxmlLink, - Value: utils.String(xmlLink), + parameters.Properties = &apioperationpolicy.PolicyContractProperties{ + Format: pointer.To(apioperationpolicy.PolicyContentFormatRawxmlNegativelink), + Value: xmlLink, } } - if parameters.PolicyContractProperties == nil { + if parameters.Properties == nil { return fmt.Errorf("Either `xml_content` or `xml_link` must be set") } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.OperationName, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, apioperationpolicy.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating or updating %s: %+v", id, err) } @@ -122,24 +128,24 @@ func resourceApiManagementAPIOperationPolicyRead(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiOperationPolicyID(d.Id()) + id, err := apioperationpolicy.ParseOperationID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup + resourceGroup := id.ResourceGroupName serviceName := id.ServiceName - apiName := id.ApiName - operationName := id.OperationName + apiName := getApiName(id.ApiId) + operationName := id.OperationId - resp, err := client.Get(ctx, resourceGroup, serviceName, apiName, operationName, apimanagement.PolicyExportFormatXML) + resp, err := client.Get(ctx, *id, apioperationpolicy.GetOperationOptions{Format: pointer.To(apioperationpolicy.PolicyExportFormatXml)}) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] API Operation Policy (Resource Group %q / API Management Service %q / API %q / Operation %q) was not found - removing from state!", resourceGroup, serviceName, apiName, operationName) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("making Read request for API Operation Policy (Resource Group %q / API Management Service %q / API %q / Operation %q): %+v", resourceGroup, serviceName, apiName, operationName, err) + return fmt.Errorf("making Read request for %s: %+v", *id, err) } d.Set("resource_group_name", resourceGroup) @@ -147,10 +153,10 @@ func resourceApiManagementAPIOperationPolicyRead(d *pluginsdk.ResourceData, meta d.Set("api_name", apiName) d.Set("operation_id", operationName) - if properties := resp.PolicyContractProperties; properties != nil { + if model := resp.Model; model != nil && model.Properties != nil { // when you submit an `xml_link` to the API, the API downloads this link and stores it as `xml_content` // as such there is no way to set `xml_link` and we'll let Terraform handle it - d.Set("xml_content", html.UnescapeString(*properties.Value)) + d.Set("xml_content", html.UnescapeString(model.Properties.Value)) } return nil @@ -161,18 +167,16 @@ func resourceApiManagementAPIOperationPolicyDelete(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiOperationPolicyID(d.Id()) + id, err := apioperationpolicy.ParseOperationID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - apiName := id.ApiName - operationName := id.OperationName - if resp, err := client.Delete(ctx, resourceGroup, serviceName, apiName, operationName, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting API Operation Policy (Resource Group %q / API Management Service %q / API %q / Operation %q): %+v", resourceGroup, serviceName, apiName, operationName, err) + apiName := getApiName(id.ApiId) + newId := apioperationpolicy.NewOperationID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, apiName, id.OperationId) + if resp, err := client.Delete(ctx, newId, apioperationpolicy.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", newId, err) } } diff --git a/internal/services/apimanagement/api_management_api_operation_policy_resource_test.go b/internal/services/apimanagement/api_management_api_operation_policy_resource_test.go index 9e511ac8b9da..81a1c3e584f8 100644 --- a/internal/services/apimanagement/api_management_api_operation_policy_resource_test.go +++ b/internal/services/apimanagement/api_management_api_operation_policy_resource_test.go @@ -8,13 +8,12 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementApiOperationPolicyResource struct{} @@ -96,17 +95,17 @@ func TestAccApiManagementAPIOperationPolicy_rawXml(t *testing.T) { } func (ApiManagementApiOperationPolicyResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApiOperationPolicyID(state.ID) + id, err := apioperationpolicy.ParseOperationID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.ApiOperationPoliciesClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.OperationName, apimanagement.PolicyExportFormatXML) + resp, err := clients.ApiManagement.ApiOperationPoliciesClient.Get(ctx, *id, apioperationpolicy.GetOperationOptions{Format: pointer.To(apioperationpolicy.PolicyExportFormatXml)}) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (r ApiManagementApiOperationPolicyResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_api_operation_resource.go b/internal/services/apimanagement/api_management_api_operation_resource.go index ec4f498c38f1..a0b4d7ec6852 100644 --- a/internal/services/apimanagement/api_management_api_operation_resource.go +++ b/internal/services/apimanagement/api_management_api_operation_resource.go @@ -8,15 +8,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementApiOperation() *pluginsdk.Resource { @@ -26,7 +26,7 @@ func resourceApiManagementApiOperation() *pluginsdk.Resource { Update: resourceApiManagementApiOperationCreateUpdate, Delete: resourceApiManagementApiOperationDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApiOperationID(id) + _, err := apioperation.ParseOperationID(id) return err }), @@ -120,17 +120,17 @@ func resourceApiManagementApiOperationCreateUpdate(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewApiOperationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("api_name").(string), d.Get("operation_id").(string)) + id := apioperation.NewOperationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("api_name").(string), d.Get("operation_id").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.OperationName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_api_operation", id.ID()) } } @@ -155,19 +155,19 @@ func resourceApiManagementApiOperationCreateUpdate(d *pluginsdk.ResourceData, me templateParametersRaw := d.Get("template_parameter").([]interface{}) templateParameters := schemaz.ExpandApiManagementOperationParameterContract(d, "template_parameter", templateParametersRaw) - parameters := apimanagement.OperationContract{ - OperationContractProperties: &apimanagement.OperationContractProperties{ - Description: utils.String(description), - DisplayName: utils.String(displayName), - Method: utils.String(method), + parameters := apioperation.OperationContract{ + Properties: &apioperation.OperationContractProperties{ + Description: pointer.To(description), + DisplayName: displayName, + Method: method, Request: requestContract, Responses: responseContracts, TemplateParameters: templateParameters, - URLTemplate: utils.String(urlTemplate), + UrlTemplate: urlTemplate, }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.OperationName, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, apioperation.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -181,34 +181,37 @@ func resourceApiManagementApiOperationRead(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiOperationID(d.Id()) + id, err := apioperation.ParseOperationID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.OperationName) + apiName := getApiName(id.ApiId) + + newId := apioperation.NewOperationID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, apiName, id.OperationId) + resp, err := client.Get(ctx, newId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] %s was not found - removing from state!", *id) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", newId) d.SetId("") return nil } - return fmt.Errorf("retrieving %s: %+v", *id, err) + return fmt.Errorf("retrieving %s: %+v", newId, err) } - d.Set("operation_id", id.OperationName) - d.Set("api_name", id.ApiName) + d.Set("operation_id", id.OperationId) + d.Set("api_name", apiName) d.Set("api_management_name", id.ServiceName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.OperationContractProperties; props != nil { - d.Set("description", props.Description) - d.Set("display_name", props.DisplayName) - d.Set("method", props.Method) - d.Set("url_template", props.URLTemplate) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("description", pointer.From(model.Properties.Description)) + d.Set("display_name", model.Properties.DisplayName) + d.Set("method", model.Properties.Method) + d.Set("url_template", model.Properties.UrlTemplate) - flattenedRequest, err := flattenApiManagementOperationRequestContract(props.Request) + flattenedRequest, err := flattenApiManagementOperationRequestContract(model.Properties.Request) if err != nil { return err } @@ -216,7 +219,7 @@ func resourceApiManagementApiOperationRead(d *pluginsdk.ResourceData, meta inter return fmt.Errorf("flattening `request`: %+v", err) } - flattenedResponse, err := flattenApiManagementOperationResponseContract(props.Responses) + flattenedResponse, err := flattenApiManagementOperationResponseContract(model.Properties.Responses) if err != nil { return err } @@ -224,7 +227,7 @@ func resourceApiManagementApiOperationRead(d *pluginsdk.ResourceData, meta inter return fmt.Errorf("flattening `response`: %+v", err) } - flattenedTemplateParams, err := schemaz.FlattenApiManagementOperationParameterContract(props.TemplateParameters) + flattenedTemplateParams, err := schemaz.FlattenApiManagementOperationParameterContract(model.Properties.TemplateParameters) if err != nil { return err } @@ -242,22 +245,25 @@ func resourceApiManagementApiOperationDelete(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiOperationID(d.Id()) + id, err := apioperation.ParseOperationID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.OperationName, "") + name := getApiName(id.ApiId) + + newId := apioperation.NewOperationID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, name, id.OperationId) + resp, err := client.Delete(ctx, newId, apioperation.DeleteOperationOptions{}) if err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting %s: %+v", *id, err) + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", newId, err) } } return nil } -func expandApiManagementOperationRequestContract(d *pluginsdk.ResourceData, schemaPath string, input []interface{}) (*apimanagement.RequestContract, error) { +func expandApiManagementOperationRequestContract(d *pluginsdk.ResourceData, schemaPath string, input []interface{}) (*apioperation.RequestContract, error) { if len(input) == 0 || input[0] == nil { return nil, nil } @@ -289,24 +295,22 @@ func expandApiManagementOperationRequestContract(d *pluginsdk.ResourceData, sche return nil, err } - return &apimanagement.RequestContract{ - Description: utils.String(description), + return &apioperation.RequestContract{ + Description: pointer.To(description), Headers: headers, QueryParameters: queryParameters, Representations: representations, }, nil } -func flattenApiManagementOperationRequestContract(input *apimanagement.RequestContract) ([]interface{}, error) { +func flattenApiManagementOperationRequestContract(input *apioperation.RequestContract) ([]interface{}, error) { if input == nil { return []interface{}{}, nil } output := make(map[string]interface{}) - if input.Description != nil { - output["description"] = *input.Description - } + output["description"] = pointer.From(input.Description) header, err := schemaz.FlattenApiManagementOperationParameterContract(input.Headers) if err != nil { @@ -329,12 +333,12 @@ func flattenApiManagementOperationRequestContract(input *apimanagement.RequestCo return []interface{}{output}, nil } -func expandApiManagementOperationResponseContract(d *pluginsdk.ResourceData, schemaPath string, input []interface{}) (*[]apimanagement.ResponseContract, error) { +func expandApiManagementOperationResponseContract(d *pluginsdk.ResourceData, schemaPath string, input []interface{}) (*[]apioperation.ResponseContract, error) { if len(input) == 0 { - return &[]apimanagement.ResponseContract{}, nil + return &[]apioperation.ResponseContract{}, nil } - outputs := make([]apimanagement.ResponseContract, 0) + outputs := make([]apioperation.ResponseContract, 0) for i, v := range input { vs := v.(map[string]interface{}) @@ -351,11 +355,11 @@ func expandApiManagementOperationResponseContract(d *pluginsdk.ResourceData, sch return nil, err } - output := apimanagement.ResponseContract{ - Description: utils.String(description), + output := apioperation.ResponseContract{ + Description: pointer.To(description), Headers: headers, Representations: representations, - StatusCode: utils.Int32(int32(statusCode)), + StatusCode: int64(statusCode), } outputs = append(outputs, output) @@ -364,7 +368,7 @@ func expandApiManagementOperationResponseContract(d *pluginsdk.ResourceData, sch return &outputs, nil } -func flattenApiManagementOperationResponseContract(input *[]apimanagement.ResponseContract) ([]interface{}, error) { +func flattenApiManagementOperationResponseContract(input *[]apioperation.ResponseContract) ([]interface{}, error) { if input == nil { return []interface{}{}, nil } @@ -378,9 +382,7 @@ func flattenApiManagementOperationResponseContract(input *[]apimanagement.Respon output["description"] = *v.Description } - if v.StatusCode != nil { - output["status_code"] = int(*v.StatusCode) - } + output["status_code"] = int(v.StatusCode) header, err := schemaz.FlattenApiManagementOperationParameterContract(v.Headers) if err != nil { diff --git a/internal/services/apimanagement/api_management_api_operation_resource_test.go b/internal/services/apimanagement/api_management_api_operation_resource_test.go index e8aa58adf7b2..011db86fa5f7 100644 --- a/internal/services/apimanagement/api_management_api_operation_resource_test.go +++ b/internal/services/apimanagement/api_management_api_operation_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementApiOperationResource struct{} @@ -140,17 +140,17 @@ func TestAccApiManagementApiOperation_complete(t *testing.T) { } func (ApiManagementApiOperationResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApiOperationID(state.ID) + id, err := apioperation.ParseOperationID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.ApiOperationsClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.OperationName) + resp, err := clients.ApiManagement.ApiOperationsClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (r ApiManagementApiOperationResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_api_operation_tag_resource.go b/internal/services/apimanagement/api_management_api_operation_tag_resource.go index 824df2081cf7..2026773c10cf 100644 --- a/internal/services/apimanagement/api_management_api_operation_tag_resource.go +++ b/internal/services/apimanagement/api_management_api_operation_tag_resource.go @@ -8,15 +8,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementApiOperationTag() *pluginsdk.Resource { @@ -27,7 +27,7 @@ func resourceApiManagementApiOperationTag() *pluginsdk.Resource { Delete: resourceApiManagementApiOperationTagDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.OperationTagID(id) + _, err := apioperationtag.ParseOperationTagID(id) return err }), @@ -64,42 +64,45 @@ func resourceApiManagementApiOperationTag() *pluginsdk.Resource { func resourceApiManagementApiOperationTagCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { subscriptionId := meta.(*clients.Client).Account.SubscriptionId - client := meta.(*clients.Client).ApiManagement.TagClient + tagClient := meta.(*clients.Client).ApiManagement.TagClient + client := meta.(*clients.Client).ApiManagement.ApiOperationTagClient ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - apiOperationId, err := parse.ApiOperationID(d.Get("api_operation_id").(string)) + apiOperationId, err := apioperationtag.ParseOperationID(d.Get("api_operation_id").(string)) if err != nil { return err } - name := d.Get("name").(string) - id := parse.NewOperationTagID(subscriptionId, apiOperationId.ResourceGroup, apiOperationId.ServiceName, apiOperationId.ApiName, apiOperationId.OperationName, name) + apiName := getApiName(apiOperationId.ApiId) + + id := apioperationtag.NewOperationTagID(subscriptionId, apiOperationId.ResourceGroupName, apiOperationId.ServiceName, apiName, apiOperationId.OperationId, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.GetByOperation(ctx, apiOperationId.ResourceGroup, apiOperationId.ServiceName, apiOperationId.ApiName, apiOperationId.OperationName, name) + existing, err := client.TagGetByOperation(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing Tag %q: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_api_operation_tag", id.ID()) } } - parameters := apimanagement.TagCreateUpdateParameters{ - TagContractProperties: &apimanagement.TagContractProperties{ - DisplayName: utils.String(d.Get("display_name").(string)), + parameters := tag.TagCreateUpdateParameters{ + Properties: &tag.TagContractProperties{ + DisplayName: d.Get("display_name").(string), }, } - if _, err := client.CreateOrUpdate(ctx, apiOperationId.ResourceGroup, apiOperationId.ServiceName, name, parameters, ""); err != nil { + tagId := tag.NewTagID(subscriptionId, apiOperationId.ResourceGroupName, apiOperationId.ServiceName, d.Get("name").(string)) + if _, err := tagClient.CreateOrUpdate(ctx, tagId, parameters, tag.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %q: %+v", id, err) } - if _, err := client.AssignToOperation(ctx, apiOperationId.ResourceGroup, apiOperationId.ServiceName, apiOperationId.ApiName, apiOperationId.OperationName, name); err != nil { + if _, err := client.TagAssignToOperation(ctx, id); err != nil { return fmt.Errorf("assigning to operation %q: %+v", id, err) } @@ -110,48 +113,54 @@ func resourceApiManagementApiOperationTagCreateUpdate(d *pluginsdk.ResourceData, func resourceApiManagementApiOperationTagRead(d *pluginsdk.ResourceData, meta interface{}) error { subscriptionId := meta.(*clients.Client).Account.SubscriptionId - client := meta.(*clients.Client).ApiManagement.TagClient + client := meta.(*clients.Client).ApiManagement.ApiOperationTagClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.OperationTagID(d.Id()) + id, err := apioperationtag.ParseOperationTagID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.TagName) + apiName := getApiName(id.ApiId) + + newId := apioperationtag.NewOperationTagID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, apiName, id.OperationId, id.TagId) + resp, err := client.TagGetByOperation(ctx, newId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] %q was not found - removing from state!", id) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %q was not found - removing from state!", newId) d.SetId("") return nil } - return fmt.Errorf("retrieving %q: %+v", id, err) + return fmt.Errorf("retrieving %q: %+v", newId, err) } - d.Set("api_operation_id", parse.NewApiOperationID(subscriptionId, id.ResourceGroup, id.ServiceName, id.ApiName, id.OperationName).ID()) - d.Set("name", id.TagName) + d.Set("api_operation_id", apioperationtag.NewOperationID(subscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId, id.OperationId).ID()) + d.Set("name", id.TagId) - if props := resp.TagContractProperties; props != nil { - d.Set("display_name", props.DisplayName) + if model := resp.Model; model != nil { + d.Set("display_name", model.Properties.DisplayName) } return nil } func resourceApiManagementApiOperationTagDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ApiManagement.TagClient + client := meta.(*clients.Client).ApiManagement.ApiOperationTagClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.OperationTagID(d.Id()) + id, err := apioperationtag.ParseOperationTagID(d.Id()) if err != nil { return err } - if _, err = client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.TagName, ""); err != nil { - return fmt.Errorf("deleting %q: %+v", id, err) + apiName := getApiName(id.ApiId) + + newId := apioperationtag.NewOperationTagID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, apiName, id.OperationId, id.TagId) + if _, err = client.TagDetachFromOperation(ctx, newId); err != nil { + return fmt.Errorf("deleting %q: %+v", newId, err) } return nil diff --git a/internal/services/apimanagement/api_management_api_operation_tag_resource_test.go b/internal/services/apimanagement/api_management_api_operation_tag_resource_test.go index 94345c347fcc..611f3306982e 100644 --- a/internal/services/apimanagement/api_management_api_operation_tag_resource_test.go +++ b/internal/services/apimanagement/api_management_api_operation_tag_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementApiOperationTagResource struct{} @@ -78,17 +78,17 @@ func TestAccApiManagementApiOperationTag_update(t *testing.T) { } func (ApiManagementApiOperationTagResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.OperationTagID(state.ID) + id, err := apioperationtag.ParseOperationTagID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.TagClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.TagName) + resp, err := clients.ApiManagement.ApiOperationTagClient.TagGetByOperation(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %q: %+v", id, err) + return nil, fmt.Errorf("retrieving %q: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (r ApiManagementApiOperationTagResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_api_policy_resource.go b/internal/services/apimanagement/api_management_api_policy_resource.go index fea03453bc14..222fb2f3e148 100644 --- a/internal/services/apimanagement/api_management_api_policy_resource.go +++ b/internal/services/apimanagement/api_management_api_policy_resource.go @@ -9,15 +9,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementApiPolicy() *pluginsdk.Resource { @@ -27,7 +28,7 @@ func resourceApiManagementApiPolicy() *pluginsdk.Resource { Update: resourceApiManagementAPIPolicyCreateUpdate, Delete: resourceApiManagementAPIPolicyDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApiPolicyID(id) + _, err := apipolicy.ParseApiID(id) return err }), @@ -38,6 +39,11 @@ func resourceApiManagementApiPolicy() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, + SchemaVersion: 1, + StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ + 0: migration.ApiManagementApiPolicyV0ToV1{}, + }), + Schema: map[string]*pluginsdk.Schema{ "resource_group_name": commonschema.ResourceGroupName(), @@ -68,30 +74,30 @@ func resourceApiManagementAPIPolicyCreateUpdate(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewApiPolicyID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("api_name").(string), string(apimanagement.PolicyExportFormatXML)) + id := apipolicy.NewApiID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("api_name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, apimanagement.PolicyExportFormatXML) + existing, err := client.Get(ctx, id, apipolicy.GetOperationOptions{Format: pointer.To(apipolicy.PolicyExportFormatXml)}) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_api_policy", id.ID()) } } - parameters := apimanagement.PolicyContract{} + parameters := apipolicy.PolicyContract{} xmlContent := d.Get("xml_content").(string) xmlLink := d.Get("xml_link").(string) if xmlLink != "" { - parameters.PolicyContractProperties = &apimanagement.PolicyContractProperties{ - Format: apimanagement.PolicyContentFormatRawxmlLink, - Value: utils.String(xmlLink), + parameters.Properties = &apipolicy.PolicyContractProperties{ + Format: pointer.To(apipolicy.PolicyContentFormatRawxmlNegativelink), + Value: xmlLink, } } else if xmlContent != "" { // this is intentionally an else-if since `xml_content` is computed @@ -101,17 +107,17 @@ func resourceApiManagementAPIPolicyCreateUpdate(d *pluginsdk.ResourceData, meta d.Set("xml_link", "") } - parameters.PolicyContractProperties = &apimanagement.PolicyContractProperties{ - Format: apimanagement.PolicyContentFormatRawxml, - Value: utils.String(xmlContent), + parameters.Properties = &apipolicy.PolicyContractProperties{ + Format: pointer.To(apipolicy.PolicyContentFormatRawxml), + Value: xmlContent, } } - if parameters.PolicyContractProperties == nil { + if parameters.Properties == nil { return fmt.Errorf("Either `xml_content` or `xml_link` must be set") } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, apipolicy.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -125,14 +131,14 @@ func resourceApiManagementAPIPolicyRead(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiPolicyID(d.Id()) + id, err := apipolicy.ParseApiID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, apimanagement.PolicyExportFormatXML) + resp, err := client.Get(ctx, *id, apipolicy.GetOperationOptions{Format: pointer.To(apipolicy.PolicyExportFormatXml)}) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -141,14 +147,15 @@ func resourceApiManagementAPIPolicyRead(d *pluginsdk.ResourceData, meta interfac return fmt.Errorf("making Read request for %s: %+v", *id, err) } - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) - d.Set("api_name", id.ApiName) + apiName := getApiName(id.ApiId) + d.Set("api_name", apiName) - if properties := resp.PolicyContractProperties; properties != nil { + if model := resp.Model; model != nil && model.Properties != nil { policyContent := "" - if pc := properties.Value; pc != nil { - policyContent = html.UnescapeString(*pc) + if pc := model.Properties.Value; pc != "" { + policyContent = html.UnescapeString(pc) } // when you submit an `xml_link` to the API, the API downloads this link and stores it as `xml_content` @@ -164,13 +171,15 @@ func resourceApiManagementAPIPolicyDelete(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiPolicyID(d.Id()) + id, err := apipolicy.ParseApiID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { + apiName := getApiName(id.ApiId) + newId := apipolicy.NewApiID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, apiName) + if resp, err := client.Delete(ctx, newId, apipolicy.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_api_policy_resource_test.go b/internal/services/apimanagement/api_management_api_policy_resource_test.go index f11b34b1a59a..9f75d92c551e 100644 --- a/internal/services/apimanagement/api_management_api_policy_resource_test.go +++ b/internal/services/apimanagement/api_management_api_policy_resource_test.go @@ -8,13 +8,12 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementApiPolicyResource struct{} @@ -101,17 +100,17 @@ func TestAccApiManagementAPIPolicy_customPolicy(t *testing.T) { } func (ApiManagementApiPolicyResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApiPolicyID(state.ID) + id, err := apipolicy.ParseApiID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.ApiPoliciesClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, apimanagement.PolicyExportFormatXML) + resp, err := clients.ApiManagement.ApiPoliciesClient.Get(ctx, *id, apipolicy.GetOperationOptions{Format: pointer.To(apipolicy.PolicyExportFormatXml)}) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementApiPolicyResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_api_release.go b/internal/services/apimanagement/api_management_api_release.go index 11f5eb35391b..e1ea7492e517 100644 --- a/internal/services/apimanagement/api_management_api_release.go +++ b/internal/services/apimanagement/api_management_api_release.go @@ -8,15 +8,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementApiRelease() *pluginsdk.Resource { @@ -34,7 +35,7 @@ func resourceApiManagementApiRelease() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApiReleaseID(id) + _, err := apirelease.ParseReleaseID(id) return err }), @@ -50,7 +51,7 @@ func resourceApiManagementApiRelease() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ApiID, + ValidateFunc: api.ValidateApiID, }, "notes": { @@ -69,34 +70,37 @@ func resourceApiManagementApiReleaseCreateUpdate(d *pluginsdk.ResourceData, meta defer cancel() name := d.Get("name").(string) - apiId, err := parse.ApiID(d.Get("api_id").(string)) + apiId, err := api.ParseApiID(d.Get("api_id").(string)) if err != nil { return err } - id := parse.NewApiReleaseID(subscriptionId, apiId.ResourceGroup, apiId.ServiceName, apiId.Name, name) + + apiName := getApiName(apiId.ApiId) + + id := apirelease.NewReleaseID(subscriptionId, apiId.ResourceGroupName, apiId.ServiceName, apiName, name) ifMatch := "*" if d.IsNewResource() { - existing, err := client.Get(ctx, apiId.ResourceGroup, apiId.ServiceName, apiId.Name, name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_api_release", id.ID()) } ifMatch = "" } - parameters := apimanagement.APIReleaseContract{ - APIReleaseContractProperties: &apimanagement.APIReleaseContractProperties{ - APIID: utils.String(d.Get("api_id").(string)), - Notes: utils.String(d.Get("notes").(string)), + parameters := apirelease.ApiReleaseContract{ + Properties: &apirelease.ApiReleaseContractProperties{ + ApiId: pointer.To(d.Get("api_id").(string)), + Notes: pointer.To(d.Get("notes").(string)), }, } - if _, err := client.CreateOrUpdate(ctx, apiId.ResourceGroup, apiId.ServiceName, apiId.Name, name, parameters, ifMatch); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, apirelease.CreateOrUpdateOperationOptions{IfMatch: pointer.To(ifMatch)}); err != nil { return fmt.Errorf("creating/ updating %s: %+v", id, err) } @@ -110,24 +114,25 @@ func resourceApiManagementApiReleaseRead(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiReleaseID(d.Id()) + id, err := apirelease.ParseReleaseID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.ReleaseName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] apimanagement %s does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("retrieving %s: %+v", id, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.ReleaseName) - if props := resp.APIReleaseContractProperties; props != nil { - d.Set("api_id", parse.NewApiID(subscriptionId, id.ResourceGroup, id.ServiceName, id.ApiName).ID()) - d.Set("notes", props.Notes) + d.Set("name", id.ReleaseId) + if model := resp.Model; model != nil && model.Properties != nil { + apiName := getApiName(id.ApiId) + d.Set("api_id", api.NewApiID(subscriptionId, id.ResourceGroupName, id.ServiceName, apiName).ID()) + d.Set("notes", pointer.From(model.Properties.Notes)) } return nil } @@ -137,13 +142,16 @@ func resourceApiManagementApiReleaseDelete(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiReleaseID(d.Id()) + id, err := apirelease.ParseReleaseID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.ReleaseName, "*"); err != nil { - return fmt.Errorf("deleting %s: %+v", id, err) + name := getApiName(id.ApiId) + + newId := apirelease.NewReleaseID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, name, id.ReleaseId) + if _, err := client.Delete(ctx, newId, apirelease.DeleteOperationOptions{IfMatch: pointer.To("*")}); err != nil { + return fmt.Errorf("deleting %s: %+v", newId, err) } return nil } diff --git a/internal/services/apimanagement/api_management_api_release_resource_test.go b/internal/services/apimanagement/api_management_api_release_resource_test.go index 80adb654f008..4b4b08c4093f 100644 --- a/internal/services/apimanagement/api_management_api_release_resource_test.go +++ b/internal/services/apimanagement/api_management_api_release_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementApiReleaseResource struct{} @@ -100,17 +100,17 @@ func TestAccApiManagementApiRelease_update(t *testing.T) { } func (ApiManagementApiReleaseResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApiReleaseID(state.ID) + id, err := apirelease.ParseReleaseID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.ApiReleasesClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.ReleaseName) + resp, err := clients.ApiManagement.ApiReleasesClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading ApiManagement Api Release (%s): %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (r ApiManagementApiReleaseResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_api_resource.go b/internal/services/apimanagement/api_management_api_resource.go index 26635d0fdbdc..5205a10ae71d 100644 --- a/internal/services/apimanagement/api_management_api_resource.go +++ b/internal/services/apimanagement/api_management_api_resource.go @@ -9,18 +9,18 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/features" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementApi() *pluginsdk.Resource { @@ -30,7 +30,7 @@ func resourceApiManagementApi() *pluginsdk.Resource { Update: resourceApiManagementApiCreateUpdate, Delete: resourceApiManagementApiDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApiID(id) + _, err := api.ParseApiID(id) return err }), @@ -69,10 +69,10 @@ func resourceApiManagementApi() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.ProtocolHTTP), - string(apimanagement.ProtocolHTTPS), - string(apimanagement.ProtocolWs), - string(apimanagement.ProtocolWss), + string(api.ProtocolHTTP), + string(api.ProtocolHTTPS), + string(api.ProtocolWs), + string(api.ProtocolWss), }, false), }, }, @@ -96,10 +96,10 @@ func resourceApiManagementApi() *pluginsdk.Resource { Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.APITypeGraphql), - string(apimanagement.APITypeHTTP), - string(apimanagement.APITypeSoap), - string(apimanagement.APITypeWebsocket), + string(api.ApiTypeGraphql), + string(api.ApiTypeHTTP), + string(api.ApiTypeSoap), + string(api.ApiTypeWebsocket), }, false), }, @@ -150,16 +150,16 @@ func resourceApiManagementApi() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.ContentFormatOpenapi), - string(apimanagement.ContentFormatOpenapijson), - string(apimanagement.ContentFormatOpenapijsonLink), - string(apimanagement.ContentFormatOpenapiLink), - string(apimanagement.ContentFormatSwaggerJSON), - string(apimanagement.ContentFormatSwaggerLinkJSON), - string(apimanagement.ContentFormatWadlLinkJSON), - string(apimanagement.ContentFormatWadlXML), - string(apimanagement.ContentFormatWsdl), - string(apimanagement.ContentFormatWsdlLink), + string(api.ContentFormatOpenapi), + string(api.ContentFormatOpenapiPositivejson), + string(api.ContentFormatOpenapiPositivejsonNegativelink), + string(api.ContentFormatOpenapiNegativelink), + string(api.ContentFormatSwaggerNegativejson), + string(api.ContentFormatSwaggerNegativelinkNegativejson), + string(api.ContentFormatWadlNegativelinkNegativejson), + string(api.ContentFormatWadlNegativexml), + string(api.ContentFormatWsdl), + string(api.ContentFormatWsdlNegativelink), }, false), }, @@ -290,8 +290,8 @@ func resourceApiManagementApi() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.BearerTokenSendingMethodsAuthorizationHeader), - string(apimanagement.BearerTokenSendingMethodsQuery), + string(api.BearerTokenSendingMethodsAuthorizationHeader), + string(api.BearerTokenSendingMethodsQuery), }, false), }, }, @@ -351,11 +351,11 @@ func resourceApiManagementApiCreateUpdate(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewApiID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) + id := api.NewApiID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) revision := d.Get("revision").(string) path := d.Get("path").(string) - apiId := fmt.Sprintf("%s;rev=%s", id.Name, revision) + apiId := fmt.Sprintf("%s;rev=%s", d.Get("name").(string), revision) version := d.Get("version").(string) versionSetId := d.Get("version_set_id").(string) displayName := d.Get("display_name").(string) @@ -371,34 +371,34 @@ func resourceApiManagementApiCreateUpdate(d *pluginsdk.ResourceData, meta interf return fmt.Errorf("`display_name`, `protocols` are required when `source_api_id` is not set") } + newId := api.NewApiID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), apiId) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, apiId) + existing, err := client.Get(ctx, newId) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing %s: %s", id, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of an existing %s: %+v", newId, err) } } - - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_api_management_api", id.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_api_management_api", newId.ID()) } } - apiType := apimanagement.APITypeHTTP + apiType := api.ApiTypeHTTP if v, ok := d.GetOk("api_type"); ok { - apiType = apimanagement.APIType(v.(string)) + apiType = api.ApiType(v.(string)) } if !features.FourPointOhBeta() { if d.Get("soap_pass_through").(bool) { - apiType = apimanagement.APITypeSoap + apiType = api.ApiTypeSoap } } - soapApiType := map[apimanagement.APIType]apimanagement.SoapAPIType{ - apimanagement.APITypeGraphql: apimanagement.SoapAPITypeGraphQL, - apimanagement.APITypeHTTP: apimanagement.SoapAPITypeSoapToRest, - apimanagement.APITypeSoap: apimanagement.SoapAPITypeSoapPassThrough, - apimanagement.APITypeWebsocket: apimanagement.SoapAPITypeWebSocket, + soapApiType := map[api.ApiType]api.SoapApiType{ + api.ApiTypeGraphql: api.SoapApiTypeGraphql, + api.ApiTypeHTTP: api.SoapApiTypeHTTP, + api.ApiTypeSoap: api.SoapApiTypeSoap, + api.ApiTypeWebsocket: api.SoapApiTypeWebsocket, }[apiType] // If import is used, we need to send properties to Azure API in two operations. @@ -409,15 +409,15 @@ func resourceApiManagementApiCreateUpdate(d *pluginsdk.ResourceData, meta interf contentFormat := importV["content_format"].(string) contentValue := importV["content_value"].(string) - log.Printf("[DEBUG] Importing API Management API %q of type %q", id.Name, contentFormat) - apiParams := apimanagement.APICreateOrUpdateParameter{ - APICreateOrUpdateProperties: &apimanagement.APICreateOrUpdateProperties{ - APIType: apiType, - SoapAPIType: soapApiType, - Format: apimanagement.ContentFormat(contentFormat), - Value: utils.String(contentValue), - Path: utils.String(path), - APIVersion: utils.String(version), + log.Printf("[DEBUG] Importing API Management API %q of type %q", id.ApiId, contentFormat) + apiParams := api.ApiCreateOrUpdateParameter{ + Properties: &api.ApiCreateOrUpdateProperties{ + Type: pointer.To(apiType), + ApiType: pointer.To(soapApiType), + Format: pointer.To(api.ContentFormat(contentFormat)), + Value: pointer.To(contentValue), + Path: path, + ApiVersion: pointer.To(version), }, } wsdlSelectorVs := importV["wsdl_selector"].([]interface{}) @@ -427,24 +427,19 @@ func resourceApiManagementApiCreateUpdate(d *pluginsdk.ResourceData, meta interf wSvcName := wsdlSelectorV["service_name"].(string) wEndpName := wsdlSelectorV["endpoint_name"].(string) - apiParams.APICreateOrUpdateProperties.WsdlSelector = &apimanagement.APICreateOrUpdatePropertiesWsdlSelector{ - WsdlServiceName: utils.String(wSvcName), - WsdlEndpointName: utils.String(wEndpName), + apiParams.Properties.WsdlSelector = &api.ApiCreateOrUpdatePropertiesWsdlSelector{ + WsdlServiceName: pointer.To(wSvcName), + WsdlEndpointName: pointer.To(wEndpName), } } if versionSetId != "" { - apiParams.APICreateOrUpdateProperties.APIVersionSetID = utils.String(versionSetId) + apiParams.Properties.ApiVersionSetId = pointer.To(versionSetId) } - - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, apiId, apiParams, "") - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, apiParams, api.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting on creating/updating %s: %+v", id, err) - } } description := d.Get("description").(string) @@ -454,7 +449,7 @@ func resourceApiManagementApiCreateUpdate(d *pluginsdk.ResourceData, meta interf subscriptionKeyParameterNamesRaw := d.Get("subscription_key_parameter_names").([]interface{}) subscriptionKeyParameterNames := expandApiManagementApiSubscriptionKeyParamNames(subscriptionKeyParameterNamesRaw) - authenticationSettings := &apimanagement.AuthenticationSettingsContract{} + authenticationSettings := &api.AuthenticationSettingsContract{} oAuth2AuthorizationSettingsRaw := d.Get("oauth2_authorization").([]interface{}) oAuth2AuthorizationSettings := expandApiManagementOAuth2AuthenticationSettingsContract(oAuth2AuthorizationSettingsRaw) @@ -470,50 +465,43 @@ func resourceApiManagementApiCreateUpdate(d *pluginsdk.ResourceData, meta interf licenseInfoRaw := d.Get("license").([]interface{}) licenseInfo := expandApiManagementApiLicense(licenseInfoRaw) - params := apimanagement.APICreateOrUpdateParameter{ - APICreateOrUpdateProperties: &apimanagement.APICreateOrUpdateProperties{ - APIType: apiType, - SoapAPIType: soapApiType, - Description: utils.String(description), - Path: utils.String(path), + params := api.ApiCreateOrUpdateParameter{ + Properties: &api.ApiCreateOrUpdateProperties{ + Type: pointer.To(apiType), + ApiType: pointer.To(soapApiType), + Description: pointer.To(description), + Path: path, Protocols: protocols, - ServiceURL: utils.String(serviceUrl), + ServiceUrl: pointer.To(serviceUrl), SubscriptionKeyParameterNames: subscriptionKeyParameterNames, - APIVersion: utils.String(version), + ApiVersion: pointer.To(version), SubscriptionRequired: &subscriptionRequired, AuthenticationSettings: authenticationSettings, - APIRevisionDescription: utils.String(d.Get("revision_description").(string)), - APIVersionDescription: utils.String(d.Get("version_description").(string)), + ApiRevisionDescription: pointer.To(d.Get("revision_description").(string)), + ApiVersionDescription: pointer.To(d.Get("version_description").(string)), Contact: contactInfo, License: licenseInfo, }, } if sourceApiId != "" { - params.APICreateOrUpdateProperties.SourceAPIID = &sourceApiId + params.Properties.SourceApiId = pointer.To(sourceApiId) } - if displayName != "" { - params.APICreateOrUpdateProperties.DisplayName = &displayName + params.Properties.DisplayName = pointer.To(displayName) } - if versionSetId != "" { - params.APICreateOrUpdateProperties.APIVersionSetID = utils.String(versionSetId) + params.Properties.ApiVersionSetId = pointer.To(versionSetId) } if v, ok := d.GetOk("terms_of_service_url"); ok { - params.APICreateOrUpdateProperties.TermsOfServiceURL = utils.String(v.(string)) + params.Properties.TermsOfServiceUrl = pointer.To(v.(string)) } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, apiId, params, "") - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, newId, params, api.CreateOrUpdateOperationOptions{IfMatch: pointer.To("*")}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting on creating/updating %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceApiManagementApiRead(d, meta) } @@ -523,77 +511,72 @@ func resourceApiManagementApiRead(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiID(d.Id()) + id, err := api.ParseApiID(d.Id()) if err != nil { return err } - name := id.Name - revision := "" - if strings.Contains(id.Name, ";") { - name = strings.Split(id.Name, ";")[0] - revision = strings.Split(id.Name, "=")[1] - } - - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + name := getApiName(id.ApiId) + newId := api.NewApiID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, name) + resp, err := client.Get(ctx, newId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] API %q Revision %q (API Management Service %q / Resource Group %q) does not exist - removing from state!", name, revision, id.ServiceName, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", newId) d.SetId("") return nil } - return fmt.Errorf("retrieving API %q / Revision %q (API Management Service %q / Resource Group %q): %+v", name, revision, id.ServiceName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", newId, err) } d.Set("api_management_name", id.ServiceName) d.Set("name", name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.APIContractProperties; props != nil { - apiType := string(props.APIType) + if model := resp.Model; model != nil && model.Properties != nil { + apiType := string(pointer.From(model.Properties.Type)) if len(apiType) == 0 { - apiType = string(apimanagement.APITypeHTTP) + apiType = string(api.ApiTypeHTTP) } d.Set("api_type", apiType) - d.Set("description", props.Description) - d.Set("display_name", props.DisplayName) - d.Set("is_current", props.IsCurrent) - d.Set("is_online", props.IsOnline) - d.Set("path", props.Path) - d.Set("service_url", props.ServiceURL) - d.Set("revision", props.APIRevision) + d.Set("description", pointer.From(model.Properties.Description)) + d.Set("display_name", pointer.From(model.Properties.DisplayName)) + d.Set("is_current", pointer.From(model.Properties.IsCurrent)) + d.Set("is_online", pointer.From(model.Properties.IsOnline)) + d.Set("path", model.Properties.Path) + d.Set("service_url", pointer.From(model.Properties.ServiceUrl)) + d.Set("revision", pointer.From(model.Properties.ApiRevision)) if !features.FourPointOhBeta() { - d.Set("soap_pass_through", apiType == string(apimanagement.SoapAPITypeSoapPassThrough)) + d.Set("soap_pass_through", apiType == string(api.ApiTypeSoap)) } - d.Set("subscription_required", props.SubscriptionRequired) - d.Set("version", props.APIVersion) - d.Set("version_set_id", props.APIVersionSetID) - d.Set("revision_description", props.APIRevisionDescription) - d.Set("version_description", props.APIVersionDescription) - d.Set("terms_of_service_url", props.TermsOfServiceURL) - - if err := d.Set("protocols", flattenApiManagementApiProtocols(props.Protocols)); err != nil { + d.Set("subscription_required", pointer.From(model.Properties.SubscriptionRequired)) + d.Set("version", pointer.From(model.Properties.ApiVersion)) + d.Set("version_set_id", pointer.From(model.Properties.ApiVersionSetId)) + d.Set("revision_description", pointer.From(model.Properties.ApiRevisionDescription)) + d.Set("version_description", pointer.From(model.Properties.ApiVersionDescription)) + d.Set("terms_of_service_url", pointer.From(model.Properties.TermsOfServiceUrl)) + + if err := d.Set("protocols", flattenApiManagementApiProtocols(model.Properties.Protocols)); err != nil { return fmt.Errorf("setting `protocols`: %s", err) } - if err := d.Set("subscription_key_parameter_names", flattenApiManagementApiSubscriptionKeyParamNames(props.SubscriptionKeyParameterNames)); err != nil { + if err := d.Set("subscription_key_parameter_names", flattenApiManagementApiSubscriptionKeyParamNames(model.Properties.SubscriptionKeyParameterNames)); err != nil { return fmt.Errorf("setting `subscription_key_parameter_names`: %+v", err) } - if err := d.Set("oauth2_authorization", flattenApiManagementOAuth2Authorization(props.AuthenticationSettings.OAuth2)); err != nil { + if err := d.Set("oauth2_authorization", flattenApiManagementOAuth2Authorization(model.Properties.AuthenticationSettings.OAuth2)); err != nil { return fmt.Errorf("setting `oauth2_authorization`: %+v", err) } - if err := d.Set("openid_authentication", flattenApiManagementOpenIDAuthentication(props.AuthenticationSettings.Openid)); err != nil { + if err := d.Set("openid_authentication", flattenApiManagementOpenIDAuthentication(model.Properties.AuthenticationSettings.Openid)); err != nil { return fmt.Errorf("setting `openid_authentication`: %+v", err) } - if err := d.Set("contact", flattenApiManagementApiContact(props.Contact)); err != nil { + if err := d.Set("contact", flattenApiManagementApiContact(model.Properties.Contact)); err != nil { return fmt.Errorf("setting `contact`: %+v", err) } - if err := d.Set("license", flattenApiManagementApiLicense(props.License)); err != nil { + if err := d.Set("license", flattenApiManagementApiLicense(model.Properties.License)); err != nil { return fmt.Errorf("setting `license`: %+v", err) } } @@ -606,42 +589,37 @@ func resourceApiManagementApiDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiID(d.Id()) + id, err := api.ParseApiID(d.Id()) if err != nil { return err } - name := id.Name - revision := "" - if strings.Contains(id.Name, ";") { - name = strings.Split(id.Name, ";")[0] - revision = strings.Split(id.Name, "=")[1] - } + name := getApiName(id.ApiId) - deleteRevisions := utils.Bool(true) - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, name, "", deleteRevisions); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting API %q / Revision %q (API Management Service %q / Resource Group %q): %s", name, revision, id.ServiceName, id.ResourceGroup, err) + newId := api.NewApiID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, name) + if resp, err := client.Delete(ctx, newId, api.DeleteOperationOptions{DeleteRevisions: pointer.To(true)}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", newId, err) } } return nil } -func expandApiManagementApiProtocols(input []interface{}) *[]apimanagement.Protocol { +func expandApiManagementApiProtocols(input []interface{}) *[]api.Protocol { if len(input) == 0 { return nil } - results := make([]apimanagement.Protocol, 0) + results := make([]api.Protocol, 0) for _, v := range input { - results = append(results, apimanagement.Protocol(v.(string))) + results = append(results, api.Protocol(v.(string))) } return &results } -func flattenApiManagementApiProtocols(input *[]apimanagement.Protocol) []string { +func flattenApiManagementApiProtocols(input *[]api.Protocol) []string { if input == nil { return []string{} } @@ -654,7 +632,7 @@ func flattenApiManagementApiProtocols(input *[]apimanagement.Protocol) []string return results } -func expandApiManagementApiSubscriptionKeyParamNames(input []interface{}) *apimanagement.SubscriptionKeyParameterNamesContract { +func expandApiManagementApiSubscriptionKeyParamNames(input []interface{}) *api.SubscriptionKeyParameterNamesContract { if len(input) == 0 { return nil } @@ -662,99 +640,84 @@ func expandApiManagementApiSubscriptionKeyParamNames(input []interface{}) *apima v := input[0].(map[string]interface{}) query := v["query"].(string) header := v["header"].(string) - contract := apimanagement.SubscriptionKeyParameterNamesContract{ - Query: utils.String(query), - Header: utils.String(header), + contract := api.SubscriptionKeyParameterNamesContract{ + Query: pointer.To(query), + Header: pointer.To(header), } return &contract } -func flattenApiManagementApiSubscriptionKeyParamNames(paramNames *apimanagement.SubscriptionKeyParameterNamesContract) []interface{} { +func flattenApiManagementApiSubscriptionKeyParamNames(paramNames *api.SubscriptionKeyParameterNamesContract) []interface{} { if paramNames == nil { return make([]interface{}, 0) } result := make(map[string]interface{}) - if paramNames.Header != nil { - result["header"] = *paramNames.Header - } - - if paramNames.Query != nil { - result["query"] = *paramNames.Query - } + result["header"] = pointer.From(paramNames.Header) + result["query"] = pointer.From(paramNames.Query) return []interface{}{result} } -func expandApiManagementOAuth2AuthenticationSettingsContract(input []interface{}) *apimanagement.OAuth2AuthenticationSettingsContract { +func expandApiManagementOAuth2AuthenticationSettingsContract(input []interface{}) *api.OAuth2AuthenticationSettingsContract { if len(input) == 0 { return nil } oAuth2AuthorizationV := input[0].(map[string]interface{}) - return &apimanagement.OAuth2AuthenticationSettingsContract{ - AuthorizationServerID: utils.String(oAuth2AuthorizationV["authorization_server_name"].(string)), - Scope: utils.String(oAuth2AuthorizationV["scope"].(string)), + return &api.OAuth2AuthenticationSettingsContract{ + AuthorizationServerId: pointer.To(oAuth2AuthorizationV["authorization_server_name"].(string)), + Scope: pointer.To(oAuth2AuthorizationV["scope"].(string)), } } -func flattenApiManagementOAuth2Authorization(input *apimanagement.OAuth2AuthenticationSettingsContract) []interface{} { +func flattenApiManagementOAuth2Authorization(input *api.OAuth2AuthenticationSettingsContract) []interface{} { if input == nil { return make([]interface{}, 0) } result := make(map[string]interface{}) - authServerId := "" - if input.AuthorizationServerID != nil { - authServerId = *input.AuthorizationServerID - } - result["authorization_server_name"] = authServerId - if input.Scope != nil { - result["scope"] = *input.Scope - } + result["authorization_server_name"] = pointer.From(input.AuthorizationServerId) + result["scope"] = pointer.From(input.Scope) return []interface{}{result} } -func expandApiManagementOpenIDAuthenticationSettingsContract(input []interface{}) *apimanagement.OpenIDAuthenticationSettingsContract { +func expandApiManagementOpenIDAuthenticationSettingsContract(input []interface{}) *api.OpenIdAuthenticationSettingsContract { if len(input) == 0 { return nil } openIDAuthorizationV := input[0].(map[string]interface{}) - return &apimanagement.OpenIDAuthenticationSettingsContract{ - OpenidProviderID: utils.String(openIDAuthorizationV["openid_provider_name"].(string)), + return &api.OpenIdAuthenticationSettingsContract{ + OpenidProviderId: pointer.To(openIDAuthorizationV["openid_provider_name"].(string)), BearerTokenSendingMethods: expandApiManagementOpenIDAuthenticationSettingsBearerTokenSendingMethods(openIDAuthorizationV["bearer_token_sending_methods"].(*pluginsdk.Set).List()), } } -func expandApiManagementOpenIDAuthenticationSettingsBearerTokenSendingMethods(input []interface{}) *[]apimanagement.BearerTokenSendingMethods { +func expandApiManagementOpenIDAuthenticationSettingsBearerTokenSendingMethods(input []interface{}) *[]api.BearerTokenSendingMethods { if input == nil { return nil } - results := make([]apimanagement.BearerTokenSendingMethods, 0) + results := make([]api.BearerTokenSendingMethods, 0) for _, v := range input { - results = append(results, apimanagement.BearerTokenSendingMethods(v.(string))) + results = append(results, api.BearerTokenSendingMethods(v.(string))) } return &results } -func flattenApiManagementOpenIDAuthentication(input *apimanagement.OpenIDAuthenticationSettingsContract) []interface{} { +func flattenApiManagementOpenIDAuthentication(input *api.OpenIdAuthenticationSettingsContract) []interface{} { if input == nil { return make([]interface{}, 0) } result := make(map[string]interface{}) - openIdProviderId := "" - if input.OpenidProviderID != nil { - openIdProviderId = *input.OpenidProviderID - } - result["openid_provider_name"] = openIdProviderId + result["openid_provider_name"] = pointer.From(input.OpenidProviderId) bearerTokenSendingMethods := make([]interface{}, 0) if s := input.BearerTokenSendingMethods; s != nil { @@ -767,67 +730,63 @@ func flattenApiManagementOpenIDAuthentication(input *apimanagement.OpenIDAuthent return []interface{}{result} } -func expandApiManagementApiContact(input []interface{}) *apimanagement.APIContactInformation { +func expandApiManagementApiContact(input []interface{}) *api.ApiContactInformation { if len(input) == 0 || input[0] == nil { return nil } v := input[0].(map[string]interface{}) - return &apimanagement.APIContactInformation{ - Email: utils.String(v["email"].(string)), - Name: utils.String(v["name"].(string)), - URL: utils.String(v["url"].(string)), + return &api.ApiContactInformation{ + Email: pointer.To(v["email"].(string)), + Name: pointer.To(v["name"].(string)), + Url: pointer.To(v["url"].(string)), } } -func flattenApiManagementApiContact(contact *apimanagement.APIContactInformation) []interface{} { +func flattenApiManagementApiContact(contact *api.ApiContactInformation) []interface{} { if contact == nil { return make([]interface{}, 0) } result := make(map[string]interface{}) - if contact.Email != nil { - result["email"] = *contact.Email - } - - if contact.Name != nil { - result["name"] = *contact.Name - } - - if contact.URL != nil { - result["url"] = *contact.URL - } + result["email"] = pointer.From(contact.Email) + result["name"] = pointer.From(contact.Name) + result["url"] = pointer.From(contact.Url) return []interface{}{result} } -func expandApiManagementApiLicense(input []interface{}) *apimanagement.APILicenseInformation { +func expandApiManagementApiLicense(input []interface{}) *api.ApiLicenseInformation { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - return &apimanagement.APILicenseInformation{ - Name: utils.String(v["name"].(string)), - URL: utils.String(v["url"].(string)), + return &api.ApiLicenseInformation{ + Name: pointer.To(v["name"].(string)), + Url: pointer.To(v["url"].(string)), } } -func flattenApiManagementApiLicense(license *apimanagement.APILicenseInformation) []interface{} { +func flattenApiManagementApiLicense(license *api.ApiLicenseInformation) []interface{} { if license == nil { return make([]interface{}, 0) } result := make(map[string]interface{}) - if license.Name != nil { - result["name"] = *license.Name - } + result["name"] = pointer.From(license.Name) + result["url"] = pointer.From(license.Url) - if license.URL != nil { - result["url"] = *license.URL + return []interface{}{result} +} + +func getApiName(apiId string) string { + name := apiId + if strings.Contains(apiId, ";") { + name = strings.Split(apiId, ";")[0] } - return []interface{}{result} + return name } diff --git a/internal/services/apimanagement/api_management_api_resource_test.go b/internal/services/apimanagement/api_management_api_resource_test.go index 5c9e77c6f835..5896fd89ee30 100644 --- a/internal/services/apimanagement/api_management_api_resource_test.go +++ b/internal/services/apimanagement/api_management_api_resource_test.go @@ -8,13 +8,13 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/features" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementApiResource struct{} @@ -422,17 +422,17 @@ func TestAccApiManagementApi_contact(t *testing.T) { } func (ApiManagementApiResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApiID(state.ID) + id, err := api.ParseApiID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.ApiClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := clients.ApiManagement.ApiClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (r ApiManagementApiResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_api_schema_resource.go b/internal/services/apimanagement/api_management_api_schema_resource.go index b941bc9a06b6..9d533964e120 100644 --- a/internal/services/apimanagement/api_management_api_schema_resource.go +++ b/internal/services/apimanagement/api_management_api_schema_resource.go @@ -9,16 +9,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementApiSchema() *pluginsdk.Resource { @@ -28,7 +28,7 @@ func resourceApiManagementApiSchema() *pluginsdk.Resource { Update: resourceApiManagementApiSchemaCreateUpdate, Delete: resourceApiManagementApiSchemaDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApiSchemaID(id) + _, err := apischema.ParseApiSchemaID(id) return err }), @@ -90,67 +90,45 @@ func resourceApiManagementApiSchemaCreateUpdate(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewApiSchemaID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("api_name").(string), d.Get("schema_id").(string)) + id := apischema.NewApiSchemaID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("api_name").(string), d.Get("schema_id").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.SchemaName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_api_schema", id.ID()) } } - contentType := d.Get("content_type").(string) - parameters := apimanagement.SchemaContract{ - SchemaContractProperties: &apimanagement.SchemaContractProperties{ - ContentType: &contentType, - SchemaDocumentProperties: &apimanagement.SchemaDocumentProperties{}, + parameters := apischema.SchemaContract{ + Properties: &apischema.SchemaContractProperties{ + ContentType: d.Get("content_type").(string), + Document: &apischema.SchemaDocumentProperties{}, }, } if v, ok := d.GetOk("value"); ok { - parameters.SchemaContractProperties.SchemaDocumentProperties.Value = utils.String(v.(string)) + parameters.Properties.Document.Value = pointer.To(v.(string)) } if v, ok := d.GetOk("components"); ok { - parameters.SchemaContractProperties.SchemaDocumentProperties.Components = v.(string) + parameters.Properties.Document.Components = pointer.To(v) } if v, ok := d.GetOk("definitions"); ok { - parameters.SchemaContractProperties.SchemaDocumentProperties.Definitions = v.(string) + parameters.Properties.Document.Definitions = pointer.To(v) } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.SchemaName, parameters, "") - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, parameters, apischema.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %s", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %q: %+v", id, err) - } - err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.SchemaName) - if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return pluginsdk.RetryableError(fmt.Errorf("expected schema %s to be created but was in non existent state, retrying", id)) - } - return pluginsdk.NonRetryableError(fmt.Errorf("getting schema %s: %+v", id, err)) - } - if resp.ID == nil { - return pluginsdk.NonRetryableError(fmt.Errorf("cannot read ID for %s: %s", id, err)) - } - d.SetId(id.ID()) - return nil - }) - - if err != nil { - return fmt.Errorf("getting %s: %+v", id, err) - } + d.SetId(id.ID()) return resourceApiManagementApiSchemaRead(d, meta) } @@ -159,14 +137,14 @@ func resourceApiManagementApiSchemaRead(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiSchemaID(d.Id()) + id, err := apischema.ParseApiSchemaID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.SchemaName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -175,28 +153,28 @@ func resourceApiManagementApiSchemaRead(d *pluginsdk.ResourceData, meta interfac return fmt.Errorf("making Read request for %s: %s", *id, err) } - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) - d.Set("api_name", id.ApiName) - d.Set("schema_id", id.SchemaName) + d.Set("api_name", id.ApiId) + d.Set("schema_id", id.SchemaId) - if properties := resp.SchemaContractProperties; properties != nil { - d.Set("content_type", properties.ContentType) - if documentProperties := properties.SchemaDocumentProperties; documentProperties != nil { + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("content_type", model.Properties.ContentType) + if documentProperties := model.Properties.Document; documentProperties != nil { if documentProperties.Value != nil { - d.Set("value", documentProperties.Value) + d.Set("value", pointer.From(documentProperties.Value)) } - if properties.Components != nil { - value, err := convert2Str(properties.Components) + if documentProperties.Components != nil { + value, err := convert2Str(pointer.From(documentProperties.Components)) if err != nil { return err } d.Set("components", value) } - if properties.Definitions != nil { - value, err := convert2Str(properties.Definitions) + if documentProperties.Definitions != nil { + value, err := convert2Str(documentProperties.Definitions) if err != nil { return err } @@ -212,13 +190,13 @@ func resourceApiManagementApiSchemaDelete(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiSchemaID(d.Id()) + id, err := apischema.ParseApiSchemaID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.SchemaName, "", utils.Bool(false)); err != nil { - if !utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id, apischema.DeleteOperationOptions{Force: pointer.To(false)}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %s", *id, err) } } diff --git a/internal/services/apimanagement/api_management_api_schema_resource_test.go b/internal/services/apimanagement/api_management_api_schema_resource_test.go index 0d2b3b7c3f36..7b304b306aec 100644 --- a/internal/services/apimanagement/api_management_api_schema_resource_test.go +++ b/internal/services/apimanagement/api_management_api_schema_resource_test.go @@ -9,12 +9,12 @@ import ( "os" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementApiSchemaResource struct{} @@ -99,17 +99,17 @@ func TestAccApiManagementApiSchema_definitions(t *testing.T) { } func (ApiManagementApiSchemaResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApiSchemaID(state.ID) + id, err := apischema.ParseApiSchemaID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.ApiSchemasClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.SchemaName) + resp, err := clients.ApiManagement.ApiSchemasClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (r ApiManagementApiSchemaResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_api_tag_description_resource.go b/internal/services/apimanagement/api_management_api_tag_description_resource.go index 6aca15565d0a..00b06da093ed 100644 --- a/internal/services/apimanagement/api_management_api_tag_description_resource.go +++ b/internal/services/apimanagement/api_management_api_tag_description_resource.go @@ -8,15 +8,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementApiTagDescription() *pluginsdk.Resource { @@ -27,7 +27,7 @@ func resourceApiManagementApiTagDescription() *pluginsdk.Resource { Delete: resourceApiManagementApiTagDescriptionDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApiTagDescriptionsID(id) + _, err := apitagdescription.ParseTagDescriptionID(id) return err }), @@ -44,7 +44,7 @@ func resourceApiManagementApiTagDescription() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ApiTagID, + ValidateFunc: apitag.ValidateApiTagID, }, "description": { @@ -72,40 +72,42 @@ func resourceApiManagementApiTagDescriptionCreateUpdate(d *pluginsdk.ResourceDat ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - apiTagId, err := parse.ApiTagID(d.Get("api_tag_id").(string)) + apiTagId, err := apitag.ParseApiTagID(d.Get("api_tag_id").(string)) if err != nil { return fmt.Errorf("parsing `api_id`: %v", err) } - id := parse.NewApiTagDescriptionsID(apiTagId.SubscriptionId, apiTagId.ResourceGroup, apiTagId.ServiceName, apiTagId.ApiName, apiTagId.TagName) + apiName := getApiName(apiTagId.ApiId) + + id := apitagdescription.NewTagDescriptionID(apiTagId.SubscriptionId, apiTagId.ResourceGroupName, apiTagId.ServiceName, apiName, apiTagId.TagId) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.TagDescriptionName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_api_tag_description", id.ID()) } } - tagDescParameter := apimanagement.TagDescriptionCreateParameters{TagDescriptionBaseProperties: &apimanagement.TagDescriptionBaseProperties{}} + tagDescParameter := apitagdescription.TagDescriptionCreateParameters{Properties: &apitagdescription.TagDescriptionBaseProperties{}} if v, ok := d.GetOk("description"); ok { - tagDescParameter.Description = utils.String(v.(string)) + tagDescParameter.Properties.Description = pointer.To(v.(string)) } if v, ok := d.GetOk("external_documentation_url"); ok { - tagDescParameter.ExternalDocsURL = utils.String(v.(string)) + tagDescParameter.Properties.ExternalDocsUrl = pointer.To(v.(string)) } if v, ok := d.GetOk("external_documentation_description"); ok { - tagDescParameter.ExternalDocsDescription = utils.String(v.(string)) + tagDescParameter.Properties.ExternalDocsDescription = pointer.To(v.(string)) } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.TagDescriptionName, tagDescParameter, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, tagDescParameter, apitagdescription.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -119,27 +121,32 @@ func resourceApiManagementApiTagDescriptionRead(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiTagDescriptionsID(d.Id()) + id, err := apitagdescription.ParseTagDescriptionID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.TagDescriptionName) + apiName := getApiName(id.ApiId) + + newId := apitagdescription.NewTagDescriptionID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, apiName, id.TagDescriptionId) + resp, err := client.Get(ctx, newId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] %s was not found - removing from state!", *id) + if !response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", newId) d.SetId("") return nil } - return fmt.Errorf("retrieving %s: %+v", *id, err) + return fmt.Errorf("retrieving %s: %+v", newId, err) } - apiTagId := parse.NewApiTagID(id.SubscriptionId, id.ResourceGroup, id.ServiceName, id.ApiName, id.TagDescriptionName) + apiTagId := apitag.NewApiTagID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, apiName, id.TagDescriptionId) d.Set("api_tag_id", apiTagId.ID()) - d.Set("description", resp.Description) - d.Set("external_documentation_url", resp.ExternalDocsURL) - d.Set("external_documentation_description", resp.ExternalDocsDescription) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("description", pointer.From(model.Properties.Description)) + d.Set("external_documentation_url", pointer.From(model.Properties.ExternalDocsUrl)) + d.Set("external_documentation_description", pointer.From(model.Properties.ExternalDocsDescription)) + } return nil } @@ -149,15 +156,18 @@ func resourceApiManagementApiTagDescriptionDelete(d *pluginsdk.ResourceData, met ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiTagDescriptionsID(d.Id()) + id, err := apitagdescription.ParseTagDescriptionID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.TagDescriptionName, "") + name := getApiName(id.ApiId) + + newId := apitagdescription.NewTagDescriptionID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, name, id.TagDescriptionId) + resp, err := client.Delete(ctx, newId, apitagdescription.DeleteOperationOptions{}) if err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting %s: %+v", *id, err) + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", newId, err) } } diff --git a/internal/services/apimanagement/api_management_api_tag_description_resource_test.go b/internal/services/apimanagement/api_management_api_tag_description_resource_test.go index 3deccba685aa..af13d5dae13b 100644 --- a/internal/services/apimanagement/api_management_api_tag_description_resource_test.go +++ b/internal/services/apimanagement/api_management_api_tag_description_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementApiTagDescriptionResource struct{} @@ -71,17 +71,17 @@ func TestAccApiManagementApiTagDescription_update(t *testing.T) { } func (ApiManagementApiTagDescriptionResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApiTagDescriptionsID(state.ID) + id, err := apitagdescription.ParseTagDescriptionID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.ApiTagDescriptionClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.TagDescriptionName) + resp, err := clients.ApiManagement.ApiTagDescriptionClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %q: %+v", id, err) + return nil, fmt.Errorf("retrieving %q: %+v", id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (r ApiManagementApiTagDescriptionResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_api_tag_resource.go b/internal/services/apimanagement/api_management_api_tag_resource.go index 22f9a6507ef2..cb21f0e815be 100644 --- a/internal/services/apimanagement/api_management_api_tag_resource.go +++ b/internal/services/apimanagement/api_management_api_tag_resource.go @@ -8,13 +8,14 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementApiTag() *pluginsdk.Resource { @@ -24,7 +25,7 @@ func resourceApiManagementApiTag() *pluginsdk.Resource { Delete: resourceApiManagementApiTagDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApiTagID(id) + _, err := apitag.ParseApiTagID(id) return err }), @@ -39,7 +40,7 @@ func resourceApiManagementApiTag() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ApiID, + ValidateFunc: api.ValidateApiID, }, "name": { @@ -53,42 +54,41 @@ func resourceApiManagementApiTag() *pluginsdk.Resource { func resourceApiManagementApiTagCreate(d *pluginsdk.ResourceData, meta interface{}) error { subscriptionId := meta.(*clients.Client).Account.SubscriptionId - client := meta.(*clients.Client).ApiManagement.TagClient + tagClient := meta.(*clients.Client).ApiManagement.TagClient + client := meta.(*clients.Client).ApiManagement.ApiTagClient ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - apiId, err := parse.ApiID(d.Get("api_id").(string)) + apiId, err := api.ParseApiID(d.Get("api_id").(string)) if err != nil { return err } - tagName := d.Get("name").(string) - tagId := parse.NewTagID(subscriptionId, apiId.ResourceGroup, apiId.ServiceName, tagName) - if err != nil { - return err - } + tagId := tag.NewTagID(subscriptionId, apiId.ResourceGroupName, apiId.ServiceName, d.Get("name").(string)) - id := parse.NewApiTagID(subscriptionId, apiId.ResourceGroup, apiId.ServiceName, apiId.Name, tagId.Name) + apiName := getApiName(apiId.ApiId) - tagExists, err := client.Get(ctx, apiId.ResourceGroup, apiId.ServiceName, tagId.ID()) + id := apitag.NewApiTagID(subscriptionId, apiId.ResourceGroupName, apiId.ServiceName, apiName, d.Get("name").(string)) + + tagExists, err := tagClient.Get(ctx, tagId) if err != nil { - if !utils.ResponseWasNotFound(tagExists.Response) { + if !response.WasNotFound(tagExists.HttpResponse) { return fmt.Errorf("checking for presence of Tag %q: %s", id, err) } } - tagAssignmentExist, err := client.GetByAPI(ctx, apiId.ResourceGroup, apiId.ServiceName, apiId.Name, tagId.Name) + tagAssignmentExist, err := client.TagGetByApi(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(tagAssignmentExist.Response) { + if !response.WasNotFound(tagAssignmentExist.HttpResponse) { return fmt.Errorf("checking for presence of Tag Assignment %q: %s", id, err) } } - if !utils.ResponseWasNotFound(tagAssignmentExist.Response) { + if !response.WasNotFound(tagAssignmentExist.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_api_tag", id.ID()) } - if _, err := client.AssignToAPI(ctx, apiId.ResourceGroup, apiId.ServiceName, apiId.Name, tagId.Name); err != nil { + if _, err := client.TagAssignToApi(ctx, id); err != nil { return fmt.Errorf("assigning to Api %q: %+v", id, err) } @@ -99,49 +99,52 @@ func resourceApiManagementApiTagCreate(d *pluginsdk.ResourceData, meta interface func resourceApiManagementApiTagRead(d *pluginsdk.ResourceData, meta interface{}) error { subscriptionId := meta.(*clients.Client).Account.SubscriptionId - client := meta.(*clients.Client).ApiManagement.TagClient + client := meta.(*clients.Client).ApiManagement.ApiTagClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiTagID(d.Id()) + id, err := apitag.ParseApiTagID(d.Id()) if err != nil { return err } - apiId := parse.NewApiID(subscriptionId, id.ResourceGroup, id.ServiceName, id.ApiName) - tagId := parse.NewTagID(subscriptionId, id.ResourceGroup, id.ServiceName, id.TagName) + apiName := getApiName(id.ApiId) + + apiId := api.NewApiID(subscriptionId, id.ResourceGroupName, id.ServiceName, apiName) + tagId := apitag.NewApiTagID(subscriptionId, id.ResourceGroupName, id.ServiceName, apiName, id.TagId) - resp, err := client.GetByAPI(ctx, id.ResourceGroup, id.ServiceName, apiId.Name, tagId.Name) + resp, err := client.TagGetByApi(ctx, tagId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] %q was not found - removing from state!", id) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %q was not found - removing from state!", tagId) d.SetId("") return nil } - return fmt.Errorf("retrieving %q: %+v", id, err) + return fmt.Errorf("retrieving %q: %+v", tagId, err) } d.Set("api_id", apiId.ID()) - d.Set("name", tagId.Name) + d.Set("name", id.TagId) return nil } func resourceApiManagementApiTagDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ApiManagement.TagClient + client := meta.(*clients.Client).ApiManagement.ApiTagClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiTagID(d.Id()) + id, err := apitag.ParseApiTagID(d.Id()) if err != nil { return err } - apiId := parse.NewApiID(id.SubscriptionId, id.ResourceGroup, id.ServiceName, id.ApiName) - tagId := parse.NewTagID(id.SubscriptionId, id.ResourceGroup, id.ServiceName, id.TagName) - if _, err = client.DetachFromAPI(ctx, id.ResourceGroup, id.ServiceName, apiId.Name, tagId.Name); err != nil { - return fmt.Errorf("detaching api tag %q: %+v", id, err) + name := getApiName(id.ApiId) + + newId := apitag.NewApiTagID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, name, id.TagId) + if _, err = client.TagDetachFromApi(ctx, newId); err != nil { + return fmt.Errorf("detaching api tag %q: %+v", newId, err) } return nil diff --git a/internal/services/apimanagement/api_management_api_tag_resource_test.go b/internal/services/apimanagement/api_management_api_tag_resource_test.go index 165628b99017..c29d960b2079 100644 --- a/internal/services/apimanagement/api_management_api_tag_resource_test.go +++ b/internal/services/apimanagement/api_management_api_tag_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementApiTagResource struct{} @@ -49,17 +49,17 @@ func TestAccApiManagementApiTag_requiresImport(t *testing.T) { } func (ApiManagementApiTagResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApiTagID(state.ID) + id, err := apitag.ParseApiTagID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.TagClient.GetByAPI(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.TagName) + resp, err := clients.ApiManagement.ApiTagClient.TagGetByApi(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %q: %+v", id, err) + return nil, fmt.Errorf("retrieving %q: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (r ApiManagementApiTagResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_api_version_set_data_source.go b/internal/services/apimanagement/api_management_api_version_set_data_source.go index 51878fda4303..a4c71d4d7f75 100644 --- a/internal/services/apimanagement/api_management_api_version_set_data_source.go +++ b/internal/services/apimanagement/api_management_api_version_set_data_source.go @@ -7,13 +7,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceApiManagementApiVersionSet() *pluginsdk.Resource { @@ -62,41 +63,40 @@ func dataSourceApiManagementApiVersionSet() *pluginsdk.Resource { func dataSourceApiManagementApiVersionSetRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).ApiManagement.ApiVersionSetClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + subscriptionId := meta.(*clients.Client).Account.SubscriptionId defer cancel() - name := d.Get("name").(string) - resourceGroup := d.Get("resource_group_name").(string) - serviceName := d.Get("api_management_name").(string) + newId := apiversionset.NewApiVersionSetID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, resourceGroup, serviceName, name) + resp, err := client.Get(ctx, newId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf(": API Version Set %q (API Management Service %q / Resource Group %q) does not exist!", name, serviceName, resourceGroup) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("checking for presence of an existing %s: %+v", newId, err) } - return fmt.Errorf("reading API Version Set %q (API Management Service %q / Resource Group %q): %+v", name, serviceName, resourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", newId, err) } - if resp.ID == nil || *resp.ID == "" { - return fmt.Errorf("retrieving API Version Set %q (API Management Service %q /Resource Group %q): ID was nil or empty", name, serviceName, resourceGroup) + if resp.Model != nil && (resp.Model.Id == nil || *resp.Model.Id == "") { + return fmt.Errorf("retrieving API Version Set %q (API Management Service %q /Resource Group %q): ID was nil or empty", newId.VersionSetId, newId.ServiceName, newId.ResourceGroupName) } - id, err := parse.ApiVersionSetID(*resp.ID) + id, err := apiversionset.ParseApiVersionSetID(*resp.Model.Id) if err != nil { - return fmt.Errorf("parsing API Version Set ID: %q", *resp.ID) + return fmt.Errorf("parsing API Version Set ID: %q", *id) } + d.Set("name", id.VersionSetId) d.SetId(id.ID()) - d.Set("name", resp.Name) - d.Set("resource_group_name", resourceGroup) - d.Set("api_management_name", serviceName) - if props := resp.APIVersionSetContractProperties; props != nil { - d.Set("description", props.Description) - d.Set("display_name", props.DisplayName) - d.Set("versioning_scheme", string(props.VersioningScheme)) - d.Set("version_header_name", props.VersionHeaderName) - d.Set("version_query_name", props.VersionQueryName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("api_management_name", id.ServiceName) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("description", pointer.From(model.Properties.Description)) + d.Set("display_name", model.Properties.DisplayName) + d.Set("versioning_scheme", string(model.Properties.VersioningScheme)) + d.Set("version_header_name", pointer.From(model.Properties.VersionHeaderName)) + d.Set("version_query_name", pointer.From(model.Properties.VersionQueryName)) } return nil diff --git a/internal/services/apimanagement/api_management_api_version_set_resource.go b/internal/services/apimanagement/api_management_api_version_set_resource.go index b8c749c80c39..1b4e0a128800 100644 --- a/internal/services/apimanagement/api_management_api_version_set_resource.go +++ b/internal/services/apimanagement/api_management_api_version_set_resource.go @@ -8,17 +8,18 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementApiVersionSet() *pluginsdk.Resource { @@ -28,7 +29,7 @@ func resourceApiManagementApiVersionSet() *pluginsdk.Resource { Update: resourceApiManagementApiVersionSetCreateUpdate, Delete: resourceApiManagementApiVersionSetDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApiVersionSetID(id) + _, err := apiversionset.ParseApiVersionSetID(id) return err }), @@ -61,9 +62,9 @@ func resourceApiManagementApiVersionSet() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.VersioningSchemeHeader), - string(apimanagement.VersioningSchemeQuery), - string(apimanagement.VersioningSchemeSegment), + string(apiversionset.VersioningSchemeHeader), + string(apiversionset.VersioningSchemeQuery), + string(apiversionset.VersioningSchemeSegment), }, false), }, @@ -96,42 +97,42 @@ func resourceApiManagementApiVersionSetCreateUpdate(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewApiVersionSetID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) + id := apiversionset.NewApiVersionSetID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_api_version_set", id.ID()) } } - versioningScheme := apimanagement.VersioningScheme(d.Get("versioning_scheme").(string)) - parameters := apimanagement.APIVersionSetContract{ - APIVersionSetContractProperties: &apimanagement.APIVersionSetContractProperties{ - DisplayName: utils.String(d.Get("display_name").(string)), + versioningScheme := apiversionset.VersioningScheme(d.Get("versioning_scheme").(string)) + parameters := apiversionset.ApiVersionSetContract{ + Properties: &apiversionset.ApiVersionSetContractProperties{ + DisplayName: d.Get("display_name").(string), VersioningScheme: versioningScheme, - Description: utils.String(d.Get("description").(string)), + Description: pointer.To(d.Get("description").(string)), }, } var headerSet, querySet bool if v, ok := d.GetOk("version_header_name"); ok { headerSet = v.(string) != "" - parameters.APIVersionSetContractProperties.VersionHeaderName = utils.String(v.(string)) + parameters.Properties.VersionHeaderName = pointer.To(v.(string)) } if v, ok := d.GetOk("version_query_name"); ok { querySet = v.(string) != "" - parameters.APIVersionSetContractProperties.VersionQueryName = utils.String(v.(string)) + parameters.Properties.VersionQueryName = pointer.To(v.(string)) } switch schema := versioningScheme; schema { - case apimanagement.VersioningSchemeHeader: + case apiversionset.VersioningSchemeHeader: if !headerSet { return fmt.Errorf("`version_header_name` must be set if `versioning_schema` is `Header`") } @@ -139,7 +140,7 @@ func resourceApiManagementApiVersionSetCreateUpdate(d *pluginsdk.ResourceData, m return fmt.Errorf("`version_query_name` can not be set if `versioning_schema` is `Header`") } - case apimanagement.VersioningSchemeQuery: + case apiversionset.VersioningSchemeQuery: if headerSet { return fmt.Errorf("`version_header_name` can not be set if `versioning_schema` is `Query`") } @@ -147,7 +148,7 @@ func resourceApiManagementApiVersionSetCreateUpdate(d *pluginsdk.ResourceData, m return fmt.Errorf("`version_query_name` must be set if `versioning_schema` is `Query`") } - case apimanagement.VersioningSchemeSegment: + case apiversionset.VersioningSchemeSegment: if headerSet { return fmt.Errorf("`version_header_name` can not be set if `versioning_schema` is `Segment`") } @@ -156,7 +157,7 @@ func resourceApiManagementApiVersionSetCreateUpdate(d *pluginsdk.ResourceData, m } } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.Name, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, apiversionset.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -170,50 +171,50 @@ func resourceApiManagementApiVersionSetRead(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiVersionSetID(d.Id()) + id, err := apiversionset.ParseApiVersionSetID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Api Version Set %q (Resource Group %q / Api Management Service %q) was not found - removing from state!", id.Name, id.ResourceGroup, id.ServiceName) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("making Read request for Api Version Set %q (Resource Group %q / Api Management Service %q): %+v", id.Name, id.ResourceGroup, id.ServiceName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", resp.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.VersionSetId) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) - if props := resp.APIVersionSetContractProperties; props != nil { - d.Set("description", props.Description) - d.Set("display_name", props.DisplayName) - d.Set("versioning_scheme", string(props.VersioningScheme)) - d.Set("version_header_name", props.VersionHeaderName) - d.Set("version_query_name", props.VersionQueryName) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("description", pointer.From(model.Properties.Description)) + d.Set("display_name", model.Properties.DisplayName) + d.Set("versioning_scheme", string(model.Properties.VersioningScheme)) + d.Set("version_header_name", pointer.From(model.Properties.VersionHeaderName)) + d.Set("version_query_name", pointer.From(model.Properties.VersionQueryName)) } return nil } func resourceApiManagementApiVersionSetDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ApiManagement.ApiVersionSetClient + client := meta.(*clients.Client).ApiManagement.ApiVersionSetsClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiVersionSetID(d.Id()) + id, err := apiversionsets.ParseApiVersionSetID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.Name, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting Api Version Set %q (Resource Group %q / Api Management Service %q): %+v", id.Name, id.ResourceGroup, id.ServiceName, err) + if resp, err := client.ApiVersionSetDelete(ctx, *id, apiversionsets.ApiVersionSetDeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_api_version_set_resource_test.go b/internal/services/apimanagement/api_management_api_version_set_resource_test.go index 4def9aa8cfa8..7ce419b462a6 100644 --- a/internal/services/apimanagement/api_management_api_version_set_resource_test.go +++ b/internal/services/apimanagement/api_management_api_version_set_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementApiVersionSetResource struct{} @@ -104,17 +104,17 @@ func TestAccApiManagementApiVersionSet_update(t *testing.T) { } func (ApiManagementApiVersionSetResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApiVersionSetID(state.ID) + id, err := apiversionset.ParseApiVersionSetID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.ApiVersionSetClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := clients.ApiManagement.ApiVersionSetClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading ApiManagementApi Version Set (%s): %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (r ApiManagementApiVersionSetResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_authorization_server_resource.go b/internal/services/apimanagement/api_management_authorization_server_resource.go index de23104fe6e4..a3ce41dbe60d 100644 --- a/internal/services/apimanagement/api_management_authorization_server_resource.go +++ b/internal/services/apimanagement/api_management_authorization_server_resource.go @@ -8,16 +8,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementAuthorizationServer() *pluginsdk.Resource { @@ -27,7 +27,7 @@ func resourceApiManagementAuthorizationServer() *pluginsdk.Resource { Update: resourceApiManagementAuthorizationServerCreateUpdate, Delete: resourceApiManagementAuthorizationServerDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.AuthorizationServerID(id) + _, err := authorizationserver.ParseAuthorizationServerID(id) return err }), @@ -57,14 +57,14 @@ func resourceApiManagementAuthorizationServer() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.AuthorizationMethodDELETE), - string(apimanagement.AuthorizationMethodGET), - string(apimanagement.AuthorizationMethodHEAD), - string(apimanagement.AuthorizationMethodOPTIONS), - string(apimanagement.AuthorizationMethodPATCH), - string(apimanagement.AuthorizationMethodPOST), - string(apimanagement.AuthorizationMethodPUT), - string(apimanagement.AuthorizationMethodTRACE), + string(authorizationserver.AuthorizationMethodDELETE), + string(authorizationserver.AuthorizationMethodGET), + string(authorizationserver.AuthorizationMethodHEAD), + string(authorizationserver.AuthorizationMethodOPTIONS), + string(authorizationserver.AuthorizationMethodPATCH), + string(authorizationserver.AuthorizationMethodPOST), + string(authorizationserver.AuthorizationMethodPUT), + string(authorizationserver.AuthorizationMethodTRACE), }, false), }, Set: pluginsdk.HashString, @@ -94,10 +94,10 @@ func resourceApiManagementAuthorizationServer() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.GrantTypeAuthorizationCode), - string(apimanagement.GrantTypeClientCredentials), - string(apimanagement.GrantTypeImplicit), - string(apimanagement.GrantTypeResourceOwnerPassword), + string(authorizationserver.GrantTypeAuthorizationCode), + string(authorizationserver.GrantTypeClientCredentials), + string(authorizationserver.GrantTypeImplicit), + string(authorizationserver.GrantTypeResourceOwnerPassword), }, false), }, Set: pluginsdk.HashString, @@ -110,8 +110,8 @@ func resourceApiManagementAuthorizationServer() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.BearerTokenSendingMethodAuthorizationHeader), - string(apimanagement.BearerTokenSendingMethodQuery), + string(authorizationserver.BearerTokenSendingMethodAuthorizationHeader), + string(authorizationserver.BearerTokenSendingMethodQuery), }, false), }, Set: pluginsdk.HashString, @@ -123,8 +123,8 @@ func resourceApiManagementAuthorizationServer() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.ClientAuthenticationMethodBasic), - string(apimanagement.ClientAuthenticationMethodBody), + string(authorizationserver.ClientAuthenticationMethodBasic), + string(authorizationserver.ClientAuthenticationMethodBody), }, false), }, Set: pluginsdk.HashString, @@ -195,17 +195,17 @@ func resourceApiManagementAuthorizationServerCreateUpdate(d *pluginsdk.ResourceD ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewAuthorizationServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) + id := authorizationserver.NewAuthorizationServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_authorization_server", id.ID()) } } @@ -228,23 +228,23 @@ func resourceApiManagementAuthorizationServerCreateUpdate(d *pluginsdk.ResourceD tokenBodyParametersRaw := d.Get("token_body_parameter").([]interface{}) tokenBodyParameters := expandApiManagementAuthorizationServerTokenBodyParameters(tokenBodyParametersRaw) - params := apimanagement.AuthorizationServerContract{ - AuthorizationServerContractProperties: &apimanagement.AuthorizationServerContractProperties{ + params := authorizationserver.AuthorizationServerContract{ + Properties: &authorizationserver.AuthorizationServerContractProperties{ // Required - AuthorizationEndpoint: utils.String(authorizationEndpoint), - ClientID: utils.String(clientId), - ClientRegistrationEndpoint: utils.String(clientRegistrationEndpoint), - DisplayName: utils.String(displayName), - GrantTypes: grantTypes, + AuthorizationEndpoint: authorizationEndpoint, + ClientId: clientId, + ClientRegistrationEndpoint: clientRegistrationEndpoint, + DisplayName: displayName, + GrantTypes: pointer.From(grantTypes), // Optional ClientAuthenticationMethod: clientAuthenticationMethods, - ClientSecret: utils.String(clientSecret), - DefaultScope: utils.String(defaultScope), - Description: utils.String(description), - ResourceOwnerPassword: utils.String(resourceOwnerPassword), - ResourceOwnerUsername: utils.String(resourceOwnerUsername), - SupportState: utils.Bool(supportState), + ClientSecret: pointer.To(clientSecret), + DefaultScope: pointer.To(defaultScope), + Description: pointer.To(description), + ResourceOwnerPassword: pointer.To(resourceOwnerPassword), + ResourceOwnerUsername: pointer.To(resourceOwnerUsername), + SupportState: pointer.To(supportState), TokenBodyParameters: tokenBodyParameters, }, } @@ -252,20 +252,20 @@ func resourceApiManagementAuthorizationServerCreateUpdate(d *pluginsdk.ResourceD authorizationMethodsRaw := d.Get("authorization_methods").(*pluginsdk.Set).List() if len(authorizationMethodsRaw) > 0 { authorizationMethods := expandApiManagementAuthorizationServerAuthorizationMethods(authorizationMethodsRaw) - params.AuthorizationServerContractProperties.AuthorizationMethods = authorizationMethods + params.Properties.AuthorizationMethods = authorizationMethods } bearerTokenSendingMethodsRaw := d.Get("bearer_token_sending_methods").(*pluginsdk.Set).List() if len(bearerTokenSendingMethodsRaw) > 0 { bearerTokenSendingMethods := expandApiManagementAuthorizationServerBearerTokenSendingMethods(bearerTokenSendingMethodsRaw) - params.AuthorizationServerContractProperties.BearerTokenSendingMethods = bearerTokenSendingMethods + params.Properties.BearerTokenSendingMethods = bearerTokenSendingMethods } if tokenEndpoint := d.Get("token_endpoint").(string); tokenEndpoint != "" { - params.AuthorizationServerContractProperties.TokenEndpoint = utils.String(tokenEndpoint) + params.Properties.TokenEndpoint = pointer.To(tokenEndpoint) } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.Name, params, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, params, authorizationserver.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -279,14 +279,14 @@ func resourceApiManagementAuthorizationServerRead(d *pluginsdk.ResourceData, met ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AuthorizationServerID(d.Id()) + id, err := authorizationserver.ParseAuthorizationServerID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s does not exist - removing from state!", *id) d.SetId("") return nil @@ -296,41 +296,43 @@ func resourceApiManagementAuthorizationServerRead(d *pluginsdk.ResourceData, met } d.Set("api_management_name", id.ServiceName) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - - if props := resp.AuthorizationServerContractProperties; props != nil { - d.Set("authorization_endpoint", props.AuthorizationEndpoint) - d.Set("client_id", props.ClientID) - d.Set("client_registration_endpoint", props.ClientRegistrationEndpoint) - d.Set("default_scope", props.DefaultScope) - d.Set("description", props.Description) - d.Set("display_name", props.DisplayName) - d.Set("support_state", props.SupportState) - d.Set("token_endpoint", props.TokenEndpoint) - - // TODO: Read properties from api, https://github.com/Azure/azure-rest-api-specs/issues/14128 - d.Set("resource_owner_password", d.Get("resource_owner_password").(string)) - d.Set("resource_owner_username", d.Get("resource_owner_username").(string)) - - if err := d.Set("authorization_methods", flattenApiManagementAuthorizationServerAuthorizationMethods(props.AuthorizationMethods)); err != nil { - return fmt.Errorf("flattening `authorization_methods`: %+v", err) - } + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("name", pointer.From(model.Name)) + if model.Properties != nil { + d.Set("authorization_endpoint", model.Properties.AuthorizationEndpoint) + d.Set("client_id", model.Properties.ClientId) + d.Set("client_registration_endpoint", model.Properties.ClientRegistrationEndpoint) + d.Set("default_scope", pointer.From(model.Properties.DefaultScope)) + d.Set("description", pointer.From(model.Properties.Description)) + d.Set("display_name", model.Properties.DisplayName) + d.Set("support_state", pointer.From(model.Properties.SupportState)) + d.Set("token_endpoint", pointer.From(model.Properties.TokenEndpoint)) + + // TODO: Read properties from api, https://github.com/Azure/azure-rest-api-specs/issues/14128 + d.Set("resource_owner_password", d.Get("resource_owner_password").(string)) + d.Set("resource_owner_username", d.Get("resource_owner_username").(string)) + + if err := d.Set("authorization_methods", flattenApiManagementAuthorizationServerAuthorizationMethods(model.Properties.AuthorizationMethods)); err != nil { + return fmt.Errorf("flattening `authorization_methods`: %+v", err) + } - if err := d.Set("bearer_token_sending_methods", flattenApiManagementAuthorizationServerBearerTokenSendingMethods(props.BearerTokenSendingMethods)); err != nil { - return fmt.Errorf("flattening `bearer_token_sending_methods`: %+v", err) - } + if err := d.Set("bearer_token_sending_methods", flattenApiManagementAuthorizationServerBearerTokenSendingMethods(model.Properties.BearerTokenSendingMethods)); err != nil { + return fmt.Errorf("flattening `bearer_token_sending_methods`: %+v", err) + } - if err := d.Set("client_authentication_method", flattenApiManagementAuthorizationServerClientAuthenticationMethods(props.ClientAuthenticationMethod)); err != nil { - return fmt.Errorf("flattening `client_authentication_method`: %+v", err) - } + if err := d.Set("client_authentication_method", flattenApiManagementAuthorizationServerClientAuthenticationMethods(model.Properties.ClientAuthenticationMethod)); err != nil { + return fmt.Errorf("flattening `client_authentication_method`: %+v", err) + } - if err := d.Set("grant_types", flattenApiManagementAuthorizationServerGrantTypes(props.GrantTypes)); err != nil { - return fmt.Errorf("flattening `grant_types`: %+v", err) - } + if err := d.Set("grant_types", flattenApiManagementAuthorizationServerGrantTypes(model.Properties.GrantTypes)); err != nil { + return fmt.Errorf("flattening `grant_types`: %+v", err) + } - if err := d.Set("token_body_parameter", flattenApiManagementAuthorizationServerTokenBodyParameters(props.TokenBodyParameters)); err != nil { - return fmt.Errorf("flattening `token_body_parameter`: %+v", err) + if err := d.Set("token_body_parameter", flattenApiManagementAuthorizationServerTokenBodyParameters(model.Properties.TokenBodyParameters)); err != nil { + return fmt.Errorf("flattening `token_body_parameter`: %+v", err) + } } } @@ -342,13 +344,13 @@ func resourceApiManagementAuthorizationServerDelete(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AuthorizationServerID(d.Id()) + id, err := authorizationserver.ParseAuthorizationServerID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.Name, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id, authorizationserver.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %s", *id, err) } } @@ -356,42 +358,39 @@ func resourceApiManagementAuthorizationServerDelete(d *pluginsdk.ResourceData, m return nil } -func expandApiManagementAuthorizationServerGrantTypes(input []interface{}) *[]apimanagement.GrantType { - outputs := make([]apimanagement.GrantType, 0) +func expandApiManagementAuthorizationServerGrantTypes(input []interface{}) *[]authorizationserver.GrantType { + outputs := make([]authorizationserver.GrantType, 0) for _, v := range input { - grantType := apimanagement.GrantType(v.(string)) + grantType := authorizationserver.GrantType(v.(string)) outputs = append(outputs, grantType) } return &outputs } -func flattenApiManagementAuthorizationServerGrantTypes(input *[]apimanagement.GrantType) []interface{} { +func flattenApiManagementAuthorizationServerGrantTypes(input []authorizationserver.GrantType) []interface{} { outputs := make([]interface{}, 0) - if input == nil { - return outputs - } - for _, v := range *input { + for _, v := range input { outputs = append(outputs, string(v)) } return outputs } -func expandApiManagementAuthorizationServerAuthorizationMethods(input []interface{}) *[]apimanagement.AuthorizationMethod { - outputs := make([]apimanagement.AuthorizationMethod, 0) +func expandApiManagementAuthorizationServerAuthorizationMethods(input []interface{}) *[]authorizationserver.AuthorizationMethod { + outputs := make([]authorizationserver.AuthorizationMethod, 0) for _, v := range input { - grantType := apimanagement.AuthorizationMethod(v.(string)) + grantType := authorizationserver.AuthorizationMethod(v.(string)) outputs = append(outputs, grantType) } return &outputs } -func flattenApiManagementAuthorizationServerAuthorizationMethods(input *[]apimanagement.AuthorizationMethod) []interface{} { +func flattenApiManagementAuthorizationServerAuthorizationMethods(input *[]authorizationserver.AuthorizationMethod) []interface{} { outputs := make([]interface{}, 0) if input == nil { return outputs @@ -404,18 +403,18 @@ func flattenApiManagementAuthorizationServerAuthorizationMethods(input *[]apiman return outputs } -func expandApiManagementAuthorizationServerBearerTokenSendingMethods(input []interface{}) *[]apimanagement.BearerTokenSendingMethod { - outputs := make([]apimanagement.BearerTokenSendingMethod, 0) +func expandApiManagementAuthorizationServerBearerTokenSendingMethods(input []interface{}) *[]authorizationserver.BearerTokenSendingMethod { + outputs := make([]authorizationserver.BearerTokenSendingMethod, 0) for _, v := range input { - grantType := apimanagement.BearerTokenSendingMethod(v.(string)) + grantType := authorizationserver.BearerTokenSendingMethod(v.(string)) outputs = append(outputs, grantType) } return &outputs } -func flattenApiManagementAuthorizationServerBearerTokenSendingMethods(input *[]apimanagement.BearerTokenSendingMethod) []interface{} { +func flattenApiManagementAuthorizationServerBearerTokenSendingMethods(input *[]authorizationserver.BearerTokenSendingMethod) []interface{} { outputs := make([]interface{}, 0) if input == nil { return outputs @@ -428,18 +427,18 @@ func flattenApiManagementAuthorizationServerBearerTokenSendingMethods(input *[]a return outputs } -func expandApiManagementAuthorizationServerClientAuthenticationMethods(input []interface{}) *[]apimanagement.ClientAuthenticationMethod { - outputs := make([]apimanagement.ClientAuthenticationMethod, 0) +func expandApiManagementAuthorizationServerClientAuthenticationMethods(input []interface{}) *[]authorizationserver.ClientAuthenticationMethod { + outputs := make([]authorizationserver.ClientAuthenticationMethod, 0) for _, v := range input { - grantType := apimanagement.ClientAuthenticationMethod(v.(string)) + grantType := authorizationserver.ClientAuthenticationMethod(v.(string)) outputs = append(outputs, grantType) } return &outputs } -func flattenApiManagementAuthorizationServerClientAuthenticationMethods(input *[]apimanagement.ClientAuthenticationMethod) []interface{} { +func flattenApiManagementAuthorizationServerClientAuthenticationMethods(input *[]authorizationserver.ClientAuthenticationMethod) []interface{} { outputs := make([]interface{}, 0) if input == nil { return outputs @@ -452,17 +451,15 @@ func flattenApiManagementAuthorizationServerClientAuthenticationMethods(input *[ return outputs } -func expandApiManagementAuthorizationServerTokenBodyParameters(input []interface{}) *[]apimanagement.TokenBodyParameterContract { - outputs := make([]apimanagement.TokenBodyParameterContract, 0) +func expandApiManagementAuthorizationServerTokenBodyParameters(input []interface{}) *[]authorizationserver.TokenBodyParameterContract { + outputs := make([]authorizationserver.TokenBodyParameterContract, 0) for _, v := range input { vs := v.(map[string]interface{}) - name := vs["name"].(string) - value := vs["value"].(string) - output := apimanagement.TokenBodyParameterContract{ - Name: utils.String(name), - Value: utils.String(value), + output := authorizationserver.TokenBodyParameterContract{ + Name: vs["name"].(string), + Value: vs["value"].(string), } outputs = append(outputs, output) } @@ -470,7 +467,7 @@ func expandApiManagementAuthorizationServerTokenBodyParameters(input []interface return &outputs } -func flattenApiManagementAuthorizationServerTokenBodyParameters(input *[]apimanagement.TokenBodyParameterContract) []interface{} { +func flattenApiManagementAuthorizationServerTokenBodyParameters(input *[]authorizationserver.TokenBodyParameterContract) []interface{} { outputs := make([]interface{}, 0) if input == nil { return outputs @@ -479,13 +476,8 @@ func flattenApiManagementAuthorizationServerTokenBodyParameters(input *[]apimana for _, v := range *input { output := make(map[string]interface{}) - if v.Name != nil { - output["name"] = *v.Name - } - - if v.Value != nil { - output["value"] = *v.Value - } + output["name"] = v.Name + output["value"] = v.Value outputs = append(outputs, output) } diff --git a/internal/services/apimanagement/api_management_authorization_server_resource_test.go b/internal/services/apimanagement/api_management_authorization_server_resource_test.go index 42e93fd37d89..527ff1dc8ed7 100644 --- a/internal/services/apimanagement/api_management_authorization_server_resource_test.go +++ b/internal/services/apimanagement/api_management_authorization_server_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementAuthorizationServerResource struct{} @@ -64,17 +64,17 @@ func TestAccApiManagementAuthorizationServer_complete(t *testing.T) { } func (ApiManagementAuthorizationServerResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.AuthorizationServerID(state.ID) + id, err := authorizationserver.ParseAuthorizationServerID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.AuthorizationServersClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := clients.ApiManagement.AuthorizationServersClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (r ApiManagementAuthorizationServerResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_backend_resource.go b/internal/services/apimanagement/api_management_backend_resource.go index ac459b7b1592..406abd6ab953 100644 --- a/internal/services/apimanagement/api_management_backend_resource.go +++ b/internal/services/apimanagement/api_management_backend_resource.go @@ -9,11 +9,12 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -29,7 +30,7 @@ func resourceApiManagementBackend() *pluginsdk.Resource { Update: resourceApiManagementBackendCreateUpdate, Delete: resourceApiManagementBackendDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.BackendID(id) + _, err := backend.ParseBackendID(id) return err }), @@ -121,8 +122,8 @@ func resourceApiManagementBackend() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.BackendProtocolHTTP), - string(apimanagement.BackendProtocolSoap), + string(backend.BackendProtocolHTTP), + string(backend.BackendProtocolSoap), }, false), }, @@ -262,17 +263,17 @@ func resourceApiManagementBackendCreateUpdate(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewBackendID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) + id := backend.NewBackendID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_backend", id.ID()) } } @@ -286,23 +287,23 @@ func resourceApiManagementBackendCreateUpdate(d *pluginsdk.ResourceData, meta in tls := expandApiManagementBackendTls(tlsRaw) url := d.Get("url").(string) - backendContract := apimanagement.BackendContract{ - BackendContractProperties: &apimanagement.BackendContractProperties{ + backendContract := backend.BackendContract{ + Properties: &backend.BackendContractProperties{ Credentials: credentials, - Protocol: apimanagement.BackendProtocol(protocol), + Protocol: backend.BackendProtocol(protocol), Proxy: proxy, - TLS: tls, - URL: utils.String(url), + Tls: tls, + Url: url, }, } if description, ok := d.GetOk("description"); ok { - backendContract.BackendContractProperties.Description = utils.String(description.(string)) + backendContract.Properties.Description = pointer.To(description.(string)) } if resourceID, ok := d.GetOk("resource_id"); ok { - backendContract.BackendContractProperties.ResourceID = utils.String(resourceID.(string)) + backendContract.Properties.ResourceId = pointer.To(resourceID.(string)) } if title, ok := d.GetOk("title"); ok { - backendContract.BackendContractProperties.Title = utils.String(title.(string)) + backendContract.Properties.Title = pointer.To(title.(string)) } if serviceFabricClusterRaw, ok := d.GetOk("service_fabric_cluster"); ok { @@ -310,12 +311,12 @@ func resourceApiManagementBackendCreateUpdate(d *pluginsdk.ResourceData, meta in if err != nil { return err } - backendContract.BackendContractProperties.Properties = &apimanagement.BackendProperties{ + backendContract.Properties.Properties = &backend.BackendProperties{ ServiceFabricCluster: serviceFabricCluster, } } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.Name, backendContract, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, backendContract, backend.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -327,14 +328,14 @@ func resourceApiManagementBackendRead(d *pluginsdk.ResourceData, meta interface{ client := meta.(*clients.Client).ApiManagement.BackendClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackendID(d.Id()) + id, err := backend.ParseBackendID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s does not exist - removing from state!", *id) d.SetId("") return nil @@ -343,29 +344,31 @@ func resourceApiManagementBackendRead(d *pluginsdk.ResourceData, meta interface{ return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) d.Set("api_management_name", id.ServiceName) - d.Set("resource_group_name", id.ResourceGroup) - - if props := resp.BackendContractProperties; props != nil { - d.Set("description", props.Description) - d.Set("protocol", string(props.Protocol)) - d.Set("resource_id", props.ResourceID) - d.Set("title", props.Title) - d.Set("url", props.URL) - if err := d.Set("credentials", flattenApiManagementBackendCredentials(props.Credentials)); err != nil { - return fmt.Errorf("setting `credentials`: %s", err) - } - if err := d.Set("proxy", flattenApiManagementBackendProxy(props.Proxy)); err != nil { - return fmt.Errorf("setting `proxy`: %s", err) - } - if properties := props.Properties; properties != nil { - if err := d.Set("service_fabric_cluster", flattenApiManagementBackendServiceFabricCluster(properties.ServiceFabricCluster)); err != nil { - return fmt.Errorf("setting `service_fabric_cluster`: %s", err) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("name", pointer.From(model.Name)) + if model.Properties != nil { + d.Set("description", pointer.From(model.Properties.Description)) + d.Set("protocol", string(model.Properties.Protocol)) + d.Set("resource_id", pointer.From(model.Properties.ResourceId)) + d.Set("title", pointer.From(model.Properties.Title)) + d.Set("url", model.Properties.Url) + if err := d.Set("credentials", flattenApiManagementBackendCredentials(model.Properties.Credentials)); err != nil { + return fmt.Errorf("setting `credentials`: %s", err) + } + if err := d.Set("proxy", flattenApiManagementBackendProxy(model.Properties.Proxy)); err != nil { + return fmt.Errorf("setting `proxy`: %s", err) + } + if properties := model.Properties.Properties; properties != nil { + if err := d.Set("service_fabric_cluster", flattenApiManagementBackendServiceFabricCluster(properties.ServiceFabricCluster)); err != nil { + return fmt.Errorf("setting `service_fabric_cluster`: %s", err) + } + } + if err := d.Set("tls", flattenApiManagementBackendTls(model.Properties.Tls)); err != nil { + return fmt.Errorf("setting `tls`: %s", err) } - } - if err := d.Set("tls", flattenApiManagementBackendTls(props.TLS)); err != nil { - return fmt.Errorf("setting `tls`: %s", err) } } @@ -377,13 +380,13 @@ func resourceApiManagementBackendDelete(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackendID(d.Id()) + id, err := backend.ParseBackendID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.Name, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id, backend.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %s", *id, err) } } @@ -391,12 +394,12 @@ func resourceApiManagementBackendDelete(d *pluginsdk.ResourceData, meta interfac return nil } -func expandApiManagementBackendCredentials(input []interface{}) *apimanagement.BackendCredentialsContract { +func expandApiManagementBackendCredentials(input []interface{}) *backend.BackendCredentialsContract { if len(input) == 0 || input[0] == nil { return nil } v := input[0].(map[string]interface{}) - contract := apimanagement.BackendCredentialsContract{} + contract := backend.BackendCredentialsContract{} if authorizationRaw := v["authorization"]; authorizationRaw != nil { authorization := expandApiManagementBackendCredentialsAuthorization(authorizationRaw.([]interface{})) contract.Authorization = authorization @@ -409,26 +412,26 @@ func expandApiManagementBackendCredentials(input []interface{}) *apimanagement.B } if headerRaw := v["header"]; headerRaw != nil { header := expandApiManagementBackendCredentialsObject(headerRaw.(map[string]interface{})) - contract.Header = *header + contract.Header = header } if queryRaw := v["query"]; queryRaw != nil { query := expandApiManagementBackendCredentialsObject(queryRaw.(map[string]interface{})) - contract.Query = *query + contract.Query = query } return &contract } -func expandApiManagementBackendCredentialsAuthorization(input []interface{}) *apimanagement.BackendAuthorizationHeaderCredentials { +func expandApiManagementBackendCredentialsAuthorization(input []interface{}) *backend.BackendAuthorizationHeaderCredentials { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - credentials := apimanagement.BackendAuthorizationHeaderCredentials{} + credentials := backend.BackendAuthorizationHeaderCredentials{} if parameter := v["parameter"]; parameter != nil { - credentials.Parameter = utils.String(parameter.(string)) + credentials.Parameter = parameter.(string) } if scheme := v["scheme"]; scheme != nil { - credentials.Scheme = utils.String(scheme.(string)) + credentials.Scheme = scheme.(string) } return &credentials } @@ -441,45 +444,45 @@ func expandApiManagementBackendCredentialsObject(input map[string]interface{}) * return &output } -func expandApiManagementBackendProxy(input []interface{}) *apimanagement.BackendProxyContract { +func expandApiManagementBackendProxy(input []interface{}) *backend.BackendProxyContract { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - contract := apimanagement.BackendProxyContract{} + contract := backend.BackendProxyContract{} if password := v["password"]; password != nil { - contract.Password = utils.String(password.(string)) + contract.Password = pointer.To(password.(string)) } if url := v["url"]; url != nil { - contract.URL = utils.String(url.(string)) + contract.Url = url.(string) } if username := v["username"]; username != nil { - contract.Username = utils.String(username.(string)) + contract.Username = pointer.To(username.(string)) } return &contract } -func expandApiManagementBackendServiceFabricCluster(input []interface{}) (error, *apimanagement.BackendServiceFabricClusterProperties) { +func expandApiManagementBackendServiceFabricCluster(input []interface{}) (error, *backend.BackendServiceFabricClusterProperties) { if len(input) == 0 { return nil, nil } v := input[0].(map[string]interface{}) managementEndpoints := v["management_endpoints"].(*pluginsdk.Set).List() - maxPartitionResolutionRetries := int32(v["max_partition_resolution_retries"].(int)) - properties := apimanagement.BackendServiceFabricClusterProperties{ - ManagementEndpoints: utils.ExpandStringSlice(managementEndpoints), - MaxPartitionResolutionRetries: utils.Int32(maxPartitionResolutionRetries), + maxPartitionResolutionRetries := int64(v["max_partition_resolution_retries"].(int)) + properties := backend.BackendServiceFabricClusterProperties{ + ManagementEndpoints: pointer.From(utils.ExpandStringSlice(managementEndpoints)), + MaxPartitionResolutionRetries: pointer.To(maxPartitionResolutionRetries), } if v2, ok := v["client_certificate_thumbprint"].(string); ok && v2 != "" { - properties.ClientCertificatethumbprint = utils.String(v2) + properties.ClientCertificatethumbprint = pointer.To(v2) } if v2, ok := v["client_certificate_id"].(string); ok && v2 != "" { - properties.ClientCertificateID = utils.String(v2) + properties.ClientCertificateId = pointer.To(v2) } - if properties.ClientCertificateID == nil && properties.ClientCertificatethumbprint == nil { + if properties.ClientCertificateId == nil && properties.ClientCertificatethumbprint == nil { return fmt.Errorf("at least one of `client_certificate_thumbprint` and `client_certificate_id` must be set"), nil } @@ -499,35 +502,35 @@ func expandApiManagementBackendServiceFabricCluster(input []interface{}) (error, return nil, &properties } -func expandApiManagementBackendServiceFabricClusterServerX509Names(input []interface{}) *[]apimanagement.X509CertificateName { - results := make([]apimanagement.X509CertificateName, 0) +func expandApiManagementBackendServiceFabricClusterServerX509Names(input []interface{}) *[]backend.X509CertificateName { + results := make([]backend.X509CertificateName, 0) for _, certificateName := range input { v := certificateName.(map[string]interface{}) - result := apimanagement.X509CertificateName{ - IssuerCertificateThumbprint: utils.String(v["issuer_certificate_thumbprint"].(string)), - Name: utils.String(v["name"].(string)), + result := backend.X509CertificateName{ + IssuerCertificateThumbprint: pointer.To(v["issuer_certificate_thumbprint"].(string)), + Name: pointer.To(v["name"].(string)), } results = append(results, result) } return &results } -func expandApiManagementBackendTls(input []interface{}) *apimanagement.BackendTLSProperties { +func expandApiManagementBackendTls(input []interface{}) *backend.BackendTlsProperties { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - properties := apimanagement.BackendTLSProperties{} + properties := backend.BackendTlsProperties{} if validateCertificateChain := v["validate_certificate_chain"]; validateCertificateChain != nil { - properties.ValidateCertificateChain = utils.Bool(validateCertificateChain.(bool)) + properties.ValidateCertificateChain = pointer.To(validateCertificateChain.(bool)) } if validateCertificateName := v["validate_certificate_name"]; validateCertificateName != nil { - properties.ValidateCertificateName = utils.Bool(validateCertificateName.(bool)) + properties.ValidateCertificateName = pointer.To(validateCertificateName.(bool)) } return &properties } -func flattenApiManagementBackendCredentials(input *apimanagement.BackendCredentialsContract) []interface{} { +func flattenApiManagementBackendCredentials(input *backend.BackendCredentialsContract) []interface{} { results := make([]interface{}, 0) if input == nil { return results @@ -537,8 +540,8 @@ func flattenApiManagementBackendCredentials(input *apimanagement.BackendCredenti if input.Certificate != nil { result["certificate"] = *input.Certificate } - result["header"] = flattenApiManagementBackendCredentialsObject(input.Header) - result["query"] = flattenApiManagementBackendCredentialsObject(input.Query) + result["header"] = flattenApiManagementBackendCredentialsObject(*input.Header) + result["query"] = flattenApiManagementBackendCredentialsObject(*input.Query) return append(results, result) } @@ -553,22 +556,22 @@ func flattenApiManagementBackendCredentialsObject(input map[string][]string) map return results } -func flattenApiManagementBackendCredentialsAuthorization(input *apimanagement.BackendAuthorizationHeaderCredentials) []interface{} { +func flattenApiManagementBackendCredentialsAuthorization(input *backend.BackendAuthorizationHeaderCredentials) []interface{} { results := make([]interface{}, 0) if input == nil { return results } result := make(map[string]interface{}) - if parameter := input.Parameter; parameter != nil { - result["parameter"] = *parameter + if parameter := input.Parameter; parameter != "" { + result["parameter"] = parameter } - if scheme := input.Scheme; scheme != nil { - result["scheme"] = *scheme + if scheme := input.Scheme; scheme != "" { + result["scheme"] = scheme } return append(results, result) } -func flattenApiManagementBackendProxy(input *apimanagement.BackendProxyContract) []interface{} { +func flattenApiManagementBackendProxy(input *backend.BackendProxyContract) []interface{} { results := make([]interface{}, 0) if input == nil { return results @@ -577,16 +580,14 @@ func flattenApiManagementBackendProxy(input *apimanagement.BackendProxyContract) if password := input.Password; password != nil { result["password"] = *password } - if url := input.URL; url != nil { - result["url"] = *url - } - if username := input.Username; username != nil { - result["username"] = *username + if url := input.Url; url != "" { + result["url"] = url } + result["username"] = pointer.From(input.Username) return append(results, result) } -func flattenApiManagementBackendServiceFabricCluster(input *apimanagement.BackendServiceFabricClusterProperties) []interface{} { +func flattenApiManagementBackendServiceFabricCluster(input *backend.BackendServiceFabricClusterProperties) []interface{} { results := make([]interface{}, 0) if input == nil { return results @@ -596,24 +597,22 @@ func flattenApiManagementBackendServiceFabricCluster(input *apimanagement.Backen result["client_certificate_thumbprint"] = *clientCertificatethumbprint } - if input.ClientCertificateID != nil { - result["client_certificate_id"] = *input.ClientCertificateID + if input.ClientCertificateId != nil { + result["client_certificate_id"] = *input.ClientCertificateId } if managementEndpoints := input.ManagementEndpoints; managementEndpoints != nil { - result["management_endpoints"] = *managementEndpoints + result["management_endpoints"] = managementEndpoints } if maxPartitionResolutionRetries := input.MaxPartitionResolutionRetries; maxPartitionResolutionRetries != nil { - result["max_partition_resolution_retries"] = int(*maxPartitionResolutionRetries) - } - if serverCertificateThumbprints := input.ServerCertificateThumbprints; serverCertificateThumbprints != nil { - result["server_certificate_thumbprints"] = *serverCertificateThumbprints + result["max_partition_resolution_retries"] = int(pointer.From(input.MaxPartitionResolutionRetries)) } + result["server_certificate_thumbprints"] = pointer.From(input.ServerCertificateThumbprints) result["server_x509_name"] = flattenApiManagementBackendServiceFabricClusterServerX509Names(input.ServerX509Names) return append(results, result) } -func flattenApiManagementBackendServiceFabricClusterServerX509Names(input *[]apimanagement.X509CertificateName) []interface{} { +func flattenApiManagementBackendServiceFabricClusterServerX509Names(input *[]backend.X509CertificateName) []interface{} { results := make([]interface{}, 0) if input == nil { return results @@ -631,17 +630,13 @@ func flattenApiManagementBackendServiceFabricClusterServerX509Names(input *[]api return results } -func flattenApiManagementBackendTls(input *apimanagement.BackendTLSProperties) []interface{} { +func flattenApiManagementBackendTls(input *backend.BackendTlsProperties) []interface{} { results := make([]interface{}, 0) if input == nil { return results } result := make(map[string]interface{}) - if validateCertificateChain := input.ValidateCertificateChain; validateCertificateChain != nil { - result["validate_certificate_chain"] = *validateCertificateChain - } - if validateCertificateName := input.ValidateCertificateName; validateCertificateName != nil { - result["validate_certificate_name"] = *validateCertificateName - } + result["validate_certificate_chain"] = pointer.From(input.ValidateCertificateChain) + result["validate_certificate_name"] = pointer.From(input.ValidateCertificateName) return append(results, result) } diff --git a/internal/services/apimanagement/api_management_backend_resource_test.go b/internal/services/apimanagement/api_management_backend_resource_test.go index 58efc9e37828..22474345329b 100644 --- a/internal/services/apimanagement/api_management_backend_resource_test.go +++ b/internal/services/apimanagement/api_management_backend_resource_test.go @@ -8,12 +8,13 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementAuthorizationBackendResource struct{} @@ -206,34 +207,34 @@ func TestAccApiManagementBackend_requiresImport(t *testing.T) { } func (ApiManagementAuthorizationBackendResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.BackendID(state.ID) + id, err := backend.ParseBackendID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.BackendClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := clients.ApiManagement.BackendClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (r ApiManagementAuthorizationBackendResource) Destroy(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.BackendID(state.ID) + id, err := backend.ParseBackendID(state.ID) if err != nil { return nil, err } - resp, err := client.ApiManagement.BackendClient.Delete(ctx, id.ResourceGroup, id.ServiceName, id.Name, "") + resp, err := client.ApiManagement.BackendClient.Delete(ctx, *id, backend.DeleteOperationOptions{}) if err != nil { - if utils.ResponseWasNotFound(resp) { - return utils.Bool(true), nil + if response.WasNotFound(resp.HttpResponse) { + return pointer.To(true), nil } return nil, fmt.Errorf("deleting Backend: %+v", err) } - return utils.Bool(true), nil + return pointer.To(true), nil } func (r ApiManagementAuthorizationBackendResource) basic(data acceptance.TestData, testName string) string { diff --git a/internal/services/apimanagement/api_management_certificate_resource.go b/internal/services/apimanagement/api_management_certificate_resource.go index d1e0c1a2c92b..e8973ea52aa1 100644 --- a/internal/services/apimanagement/api_management_certificate_resource.go +++ b/internal/services/apimanagement/api_management_certificate_resource.go @@ -8,18 +8,18 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementCertificate() *pluginsdk.Resource { @@ -29,7 +29,7 @@ func resourceApiManagementCertificate() *pluginsdk.Resource { Update: resourceApiManagementCertificateCreateUpdate, Delete: resourceApiManagementCertificateDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.CertificateID(id) + _, err := certificate.ParseCertificateID(id) return err }), @@ -102,7 +102,7 @@ func resourceApiManagementCertificateCreateUpdate(d *pluginsdk.ResourceData, met ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewCertificateID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) + id := certificate.NewCertificateID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) data := d.Get("data").(string) password := d.Get("password").(string) @@ -110,20 +110,20 @@ func resourceApiManagementCertificateCreateUpdate(d *pluginsdk.ResourceData, met keyVaultIdentity := d.Get("key_vault_identity_client_id").(string) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_certificate", id.ID()) } } - parameters := apimanagement.CertificateCreateOrUpdateParameters{ - CertificateCreateOrUpdateProperties: &apimanagement.CertificateCreateOrUpdateProperties{}, + parameters := certificate.CertificateCreateOrUpdateParameters{ + Properties: &certificate.CertificateCreateOrUpdateProperties{}, } if keyVaultSecretId != "" { @@ -132,21 +132,21 @@ func resourceApiManagementCertificateCreateUpdate(d *pluginsdk.ResourceData, met return err } - parameters.KeyVault = &apimanagement.KeyVaultContractCreateProperties{ - SecretIdentifier: utils.String(parsedSecretId.ID()), + parameters.Properties.KeyVault = &certificate.KeyVaultContractCreateProperties{ + SecretIdentifier: pointer.To(parsedSecretId.ID()), } if keyVaultIdentity != "" { - parameters.KeyVault.IdentityClientID = utils.String(keyVaultIdentity) + parameters.Properties.KeyVault.IdentityClientId = pointer.To(keyVaultIdentity) } } if data != "" { - parameters.Data = utils.String(data) - parameters.Password = utils.String(password) + parameters.Properties.Data = pointer.To(data) + parameters.Properties.Password = pointer.To(password) } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.Name, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, certificate.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating or updating %s: %+v", id, err) } @@ -160,14 +160,14 @@ func resourceApiManagementCertificateRead(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CertificateID(d.Id()) + id, err := certificate.ParseCertificateID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -176,21 +176,20 @@ func resourceApiManagementCertificateRead(d *pluginsdk.ResourceData, meta interf return fmt.Errorf("making Read request for %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) - if props := resp.CertificateContractProperties; props != nil { - if expiration := props.ExpirationDate; expiration != nil { - formatted := expiration.Format(time.RFC3339) - d.Set("expiration", formatted) - } - d.Set("subject", props.Subject) - d.Set("thumbprint", props.Thumbprint) + if model := resp.Model; model != nil { + d.Set("name", pointer.From(model.Name)) + if model.Properties != nil { + d.Set("expiration", model.Properties.ExpirationDate) + d.Set("subject", model.Properties.Subject) + d.Set("thumbprint", model.Properties.Thumbprint) - if keyvault := props.KeyVault; keyvault != nil { - d.Set("key_vault_secret_id", keyvault.SecretIdentifier) - d.Set("key_vault_identity_client_id", keyvault.IdentityClientID) + if keyvault := model.Properties.KeyVault; keyvault != nil { + d.Set("key_vault_secret_id", pointer.From(keyvault.SecretIdentifier)) + d.Set("key_vault_identity_client_id", pointer.From(keyvault.IdentityClientId)) + } } } @@ -202,13 +201,13 @@ func resourceApiManagementCertificateDelete(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CertificateID(d.Id()) + id, err := certificate.ParseCertificateID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.Name, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id, certificate.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_certificate_resource_test.go b/internal/services/apimanagement/api_management_certificate_resource_test.go index cc6349a49a3d..02d27a4c7b13 100644 --- a/internal/services/apimanagement/api_management_certificate_resource_test.go +++ b/internal/services/apimanagement/api_management_certificate_resource_test.go @@ -9,12 +9,12 @@ import ( "regexp" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementCertificateResource struct{} @@ -129,17 +129,17 @@ func TestAccApiManagementCertificate_requiresImport(t *testing.T) { } func (ApiManagementCertificateResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.CertificateID(state.ID) + id, err := certificate.ParseCertificateID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.CertificatesClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := clients.ApiManagement.CertificatesClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementCertificateResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_custom_domain_resource.go b/internal/services/apimanagement/api_management_custom_domain_resource.go index c4d1454d077d..0266920e2728 100644 --- a/internal/services/apimanagement/api_management_custom_domain_resource.go +++ b/internal/services/apimanagement/api_management_custom_domain_resource.go @@ -9,15 +9,15 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) var apiManagementCustomDomainResourceName = "azurerm_api_management_custom_domain" @@ -46,7 +46,7 @@ func resourceApiManagementCustomDomain() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ApiManagementID, + ValidateFunc: apimanagementservice.ValidateServiceID, }, "management": { @@ -98,32 +98,32 @@ func apiManagementCustomDomainCreateUpdate(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - apiMgmtId, err := parse.ApiManagementID(d.Get("api_management_id").(string)) + apiMgmtId, err := apimanagementservice.ParseServiceID(d.Get("api_management_id").(string)) if err != nil { return err } - id := parse.NewCustomDomainID(apiMgmtId.SubscriptionId, apiMgmtId.ResourceGroup, apiMgmtId.ServiceName, "default") + id := parse.NewCustomDomainID(apiMgmtId.SubscriptionId, apiMgmtId.ResourceGroupName, apiMgmtId.ServiceName, "default") - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName) + existing, err := client.Get(ctx, *apiMgmtId) if err != nil { - return fmt.Errorf("retrieving %s: %+v", id, err) + return fmt.Errorf("retrieving %s: %+v", *apiMgmtId, err) } if d.IsNewResource() { - if existing.ServiceProperties != nil && existing.ServiceProperties.HostnameConfigurations != nil && len(*existing.ServiceProperties.HostnameConfigurations) > 1 { - return tf.ImportAsExistsError(apiManagementCustomDomainResourceName, *existing.ID) + if existing.Model != nil && existing.Model.Properties.HostnameConfigurations != nil && len(*existing.Model.Properties.HostnameConfigurations) > 1 { + return tf.ImportAsExistsError(apiManagementCustomDomainResourceName, *existing.Model.Id) } } - existing.ServiceProperties.HostnameConfigurations = expandApiManagementCustomDomains(d) + existing.Model.Properties.HostnameConfigurations = expandApiManagementCustomDomains(d) // Wait for the ProvisioningState to become "Succeeded" before attempting to update - log.Printf("[DEBUG] Waiting for %s to become ready", id) + log.Printf("[DEBUG] Waiting for %s to become ready", *apiMgmtId) stateConf := &pluginsdk.StateChangeConf{ Pending: []string{"Updating", "Unknown"}, Target: []string{"Succeeded", "Ready"}, - Refresh: apiManagementRefreshFunc(ctx, client, id.ServiceName, id.ResourceGroup), + Refresh: apiManagementRefreshFunc(ctx, client, *apiMgmtId), MinTimeout: 1 * time.Minute, ContinuousTargetOccurence: 6, } @@ -138,23 +138,17 @@ func apiManagementCustomDomainCreateUpdate(d *pluginsdk.ResourceData, meta inter } // The API expects user assigned identities to be submitted with nil values - if existing.Identity != nil { - for k, v := range existing.Identity.UserAssignedIdentities { - if v == nil { - continue - } - existing.Identity.UserAssignedIdentities[k].ClientID = nil - existing.Identity.UserAssignedIdentities[k].PrincipalID = nil + if existing.Model != nil && existing.Model.Identity != nil { + for k := range existing.Model.Identity.IdentityIds { + UserAssignedIdentityDetails := existing.Model.Identity.IdentityIds[k] + UserAssignedIdentityDetails.ClientId = nil + UserAssignedIdentityDetails.PrincipalId = nil } } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, existing) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, *apiMgmtId, *existing.Model); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %q: %+v", id, err) - } // Wait for the ProvisioningState to become "Succeeded" before attempting to update log.Printf("[DEBUG] Waiting for %s to become ready", id) @@ -182,11 +176,11 @@ func apiManagementCustomDomainRead(d *pluginsdk.ResourceData, meta interface{}) return err } - apiMgmtId := parse.NewApiManagementID(id.SubscriptionId, id.ResourceGroup, id.ServiceName) + apiMgmtId := apimanagementservice.NewServiceID(id.SubscriptionId, id.ResourceGroup, id.ServiceName) - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName) + resp, err := client.Get(ctx, apiMgmtId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("%s was not found - removing from state!", *id) d.SetId("") return nil @@ -197,8 +191,8 @@ func apiManagementCustomDomainRead(d *pluginsdk.ResourceData, meta interface{}) d.Set("api_management_id", apiMgmtId.ID()) - if resp.ServiceProperties != nil && resp.ServiceProperties.HostnameConfigurations != nil { - configs := flattenApiManagementHostnameConfiguration(resp.ServiceProperties.HostnameConfigurations, d, *resp.Name, *apimHostNameSuffix) + if resp.Model != nil && resp.Model.Properties.HostnameConfigurations != nil { + configs := flattenApiManagementHostnameConfiguration(resp.Model.Properties.HostnameConfigurations, d, *resp.Model.Name, *apimHostNameSuffix) for _, config := range configs { for key, v := range config.(map[string]interface{}) { // lintignore:R001 @@ -222,9 +216,11 @@ func apiManagementCustomDomainDelete(d *pluginsdk.ResourceData, meta interface{} return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName) + apiMgmtId := apimanagementservice.NewServiceID(id.SubscriptionId, id.ResourceGroup, id.ServiceName) + + resp, err := client.Get(ctx, apiMgmtId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("%s was not found - removing from state!", *id) d.SetId("") return nil @@ -238,7 +234,7 @@ func apiManagementCustomDomainDelete(d *pluginsdk.ResourceData, meta interface{} stateConf := &pluginsdk.StateChangeConf{ Pending: []string{"Updating", "Unknown"}, Target: []string{"Succeeded", "Ready"}, - Refresh: apiManagementRefreshFunc(ctx, client, id.ServiceName, id.ResourceGroup), + Refresh: apiManagementRefreshFunc(ctx, client, apiMgmtId), MinTimeout: 1 * time.Minute, Timeout: d.Timeout(pluginsdk.TimeoutDelete), ContinuousTargetOccurence: 6, @@ -250,15 +246,13 @@ func apiManagementCustomDomainDelete(d *pluginsdk.ResourceData, meta interface{} log.Printf("[DEBUG] Deleting %s", *id) - resp.ServiceProperties.HostnameConfigurations = nil + if resp.Model != nil { + resp.Model.Properties.HostnameConfigurations = nil + } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, resp) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, apiMgmtId, *resp.Model); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %q: %+v", id, err) - } // Wait for the ProvisioningState to become "Succeeded" before attempting to update log.Printf("[DEBUG] Waiting for %s to become ready", *id) @@ -269,14 +263,14 @@ func apiManagementCustomDomainDelete(d *pluginsdk.ResourceData, meta interface{} return nil } -func expandApiManagementCustomDomains(input *pluginsdk.ResourceData) *[]apimanagement.HostnameConfiguration { - results := make([]apimanagement.HostnameConfiguration, 0) +func expandApiManagementCustomDomains(input *pluginsdk.ResourceData) *[]apimanagementservice.HostnameConfiguration { + results := make([]apimanagementservice.HostnameConfiguration, 0) if managementRawVal, ok := input.GetOk("management"); ok { vs := managementRawVal.([]interface{}) for _, rawVal := range vs { v := rawVal.(map[string]interface{}) - output := expandApiManagementCommonHostnameConfiguration(v, apimanagement.HostnameTypeManagement) + output := expandApiManagementCommonHostnameConfiguration(v, apimanagementservice.HostnameTypeManagement) results = append(results, output) } } @@ -284,7 +278,7 @@ func expandApiManagementCustomDomains(input *pluginsdk.ResourceData) *[]apimanag vs := portalRawVal.([]interface{}) for _, rawVal := range vs { v := rawVal.(map[string]interface{}) - output := expandApiManagementCommonHostnameConfiguration(v, apimanagement.HostnameTypePortal) + output := expandApiManagementCommonHostnameConfiguration(v, apimanagementservice.HostnameTypePortal) results = append(results, output) } } @@ -292,7 +286,7 @@ func expandApiManagementCustomDomains(input *pluginsdk.ResourceData) *[]apimanag vs := developerPortalRawVal.([]interface{}) for _, rawVal := range vs { v := rawVal.(map[string]interface{}) - output := expandApiManagementCommonHostnameConfiguration(v, apimanagement.HostnameTypeDeveloperPortal) + output := expandApiManagementCommonHostnameConfiguration(v, apimanagementservice.HostnameTypeDeveloperPortal) results = append(results, output) } } @@ -301,9 +295,9 @@ func expandApiManagementCustomDomains(input *pluginsdk.ResourceData) *[]apimanag vs := gatewayRawVal.([]interface{}) for _, rawVal := range vs { v := rawVal.(map[string]interface{}) - output := expandApiManagementCommonHostnameConfiguration(v, apimanagement.HostnameTypeProxy) + output := expandApiManagementCommonHostnameConfiguration(v, apimanagementservice.HostnameTypeProxy) if value, ok := v["default_ssl_binding"]; ok { - output.DefaultSslBinding = utils.Bool(value.(bool)) + output.DefaultSslBinding = pointer.To(value.(bool)) } results = append(results, output) } @@ -313,14 +307,14 @@ func expandApiManagementCustomDomains(input *pluginsdk.ResourceData) *[]apimanag vs := scmRawVal.([]interface{}) for _, rawVal := range vs { v := rawVal.(map[string]interface{}) - output := expandApiManagementCommonHostnameConfiguration(v, apimanagement.HostnameTypeScm) + output := expandApiManagementCommonHostnameConfiguration(v, apimanagementservice.HostnameTypeScm) results = append(results, output) } } return &results } -func flattenApiManagementHostnameConfiguration(input *[]apimanagement.HostnameConfiguration, d *pluginsdk.ResourceData, name, apimHostNameSuffix string) []interface{} { +func flattenApiManagementHostnameConfiguration(input *[]apimanagementservice.HostnameConfiguration, d *pluginsdk.ResourceData, name, apimHostNameSuffix string) []interface{} { results := make([]interface{}, 0) if input == nil { return results @@ -336,49 +330,36 @@ func flattenApiManagementHostnameConfiguration(input *[]apimanagement.HostnameCo output := make(map[string]interface{}) // There'll always be a default custom domain with hostName "apim_name.azure-api.net" and Type "Proxy", which should be ignored - if *config.HostName == strings.ToLower(name)+"."+apimHostNameSuffix && config.Type == apimanagement.HostnameTypeProxy { + if config.HostName == strings.ToLower(name)+"."+apimHostNameSuffix && config.Type == apimanagementservice.HostnameTypeProxy { continue } - if config.HostName != nil { - output["host_name"] = *config.HostName - } - - if config.NegotiateClientCertificate != nil { - output["negotiate_client_certificate"] = *config.NegotiateClientCertificate - } - - if config.KeyVaultID != nil { - output["key_vault_id"] = *config.KeyVaultID - } - - if config.IdentityClientID != nil { - output["ssl_keyvault_identity_client_id"] = *config.IdentityClientID - } + output["host_name"] = config.HostName + output["negotiate_client_certificate"] = pointer.From(config.NegotiateClientCertificate) + output["key_vault_id"] = pointer.From(config.KeyVaultId) + output["ssl_keyvault_identity_client_id"] = pointer.From(config.IdentityClientId) var configType string switch strings.ToLower(string(config.Type)) { - case strings.ToLower(string(apimanagement.HostnameTypeProxy)): + case strings.ToLower(string(apimanagementservice.HostnameTypeProxy)): // only set SSL binding for proxy types - if config.DefaultSslBinding != nil { - output["default_ssl_binding"] = *config.DefaultSslBinding - } + output["default_ssl_binding"] = pointer.From(config.DefaultSslBinding) gatewayResults = append(gatewayResults, output) configType = "gateway" - case strings.ToLower(string(apimanagement.HostnameTypeManagement)): + case strings.ToLower(string(apimanagementservice.HostnameTypeManagement)): managementResults = append(managementResults, output) configType = "management" - case strings.ToLower(string(apimanagement.HostnameTypePortal)): + case strings.ToLower(string(apimanagementservice.HostnameTypePortal)): portalResults = append(portalResults, output) configType = "portal" - case strings.ToLower(string(apimanagement.HostnameTypeDeveloperPortal)): + case strings.ToLower(string(apimanagementservice.HostnameTypeDeveloperPortal)): developerPortalResults = append(developerPortalResults, output) configType = "developer_portal" - case strings.ToLower(string(apimanagement.HostnameTypeScm)): + case strings.ToLower(string(apimanagementservice.HostnameTypeScm)): scmResults = append(scmResults, output) configType = "scm" } @@ -386,7 +367,7 @@ func flattenApiManagementHostnameConfiguration(input *[]apimanagement.HostnameCo if configType != "" { if valsRaw, ok := d.GetOk(configType); ok { vals := valsRaw.([]interface{}) - schemaz.CopyCertificateAndPassword(vals, *config.HostName, output) + schemaz.CopyCertificateAndPassword(vals, config.HostName, output) } } } diff --git a/internal/services/apimanagement/api_management_custom_domain_resource_test.go b/internal/services/apimanagement/api_management_custom_domain_resource_test.go index b9babbd51d3b..58126e3f2ec7 100644 --- a/internal/services/apimanagement/api_management_custom_domain_resource_test.go +++ b/internal/services/apimanagement/api_management_custom_domain_resource_test.go @@ -8,12 +8,13 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementCustomDomainResource struct{} @@ -96,15 +97,14 @@ func (ApiManagementCustomDomainResource) Exists(ctx context.Context, clients *cl if err != nil { return nil, err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - resp, err := clients.ApiManagement.ServiceClient.Get(ctx, resourceGroup, serviceName) + serviceId := apimanagementservice.NewServiceID(id.SubscriptionId, id.ResourceGroup, id.ServiceName) + resp, err := clients.ApiManagement.ServiceClient.Get(ctx, serviceId) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (r ApiManagementCustomDomainResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_data_source.go b/internal/services/apimanagement/api_management_data_source.go index ab7b24e0afbf..3a4929e7fe93 100644 --- a/internal/services/apimanagement/api_management_data_source.go +++ b/internal/services/apimanagement/api_management_data_source.go @@ -8,18 +8,20 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceApiManagementService() *pluginsdk.Resource { @@ -224,7 +226,7 @@ func dataSourceApiManagementService() *pluginsdk.Resource { }, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.Tags(), }, } } @@ -238,18 +240,14 @@ func dataSourceApiManagementRead(d *pluginsdk.ResourceData, meta interface{}) er name := d.Get("name").(string) resourceGroup := d.Get("resource_group_name").(string) - resp, err := client.Get(ctx, resourceGroup, name) - if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf("API Management Service %q (Resource Group %q) was not found", name, resourceGroup) - } - - return fmt.Errorf("retrieving API Management Service %q (Resource Group %q): %+v", name, resourceGroup, err) - } + id := apimanagementservice.NewServiceID(meta.(*clients.Client).Account.SubscriptionId, resourceGroup, name) - id, err := parse.ApiManagementID(*resp.ID) + resp, err := client.Get(ctx, id) if err != nil { - return fmt.Errorf("parsing API Management ID: %q", *resp.ID) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("checking for presence of an existing %s: %+v", id, err) + } + return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) @@ -257,62 +255,65 @@ func dataSourceApiManagementRead(d *pluginsdk.ResourceData, meta interface{}) er d.Set("name", name) d.Set("resource_group_name", resourceGroup) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) - identity, err := flattenIdentity(resp.Identity) - if err != nil { - return fmt.Errorf("flattening `identity`: %+v", err) - } - if err := d.Set("identity", identity); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) - } + identity, err := identity.FlattenSystemAndUserAssignedMap(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + if err := d.Set("identity", identity); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } - if props := resp.ServiceProperties; props != nil { - d.Set("publisher_email", props.PublisherEmail) - d.Set("publisher_name", props.PublisherName) - d.Set("notification_sender_email", props.NotificationSenderEmail) - d.Set("gateway_url", props.GatewayURL) - d.Set("gateway_regional_url", props.GatewayRegionalURL) - d.Set("portal_url", props.PortalURL) - d.Set("developer_portal_url", props.DeveloperPortalURL) - d.Set("management_api_url", props.ManagementAPIURL) - d.Set("scm_url", props.ScmURL) - d.Set("public_ip_addresses", props.PublicIPAddresses) - d.Set("public_ip_address_id", props.PublicIPAddressID) - d.Set("private_ip_addresses", props.PrivateIPAddresses) - - if err := d.Set("hostname_configuration", flattenDataSourceApiManagementHostnameConfigurations(props.HostnameConfigurations)); err != nil { + d.Set("publisher_email", model.Properties.PublisherEmail) + d.Set("publisher_name", model.Properties.PublisherName) + d.Set("notification_sender_email", pointer.From(model.Properties.NotificationSenderEmail)) + d.Set("gateway_url", pointer.From(model.Properties.GatewayUrl)) + d.Set("gateway_regional_url", pointer.From(model.Properties.GatewayRegionalUrl)) + d.Set("portal_url", pointer.From(model.Properties.PortalUrl)) + d.Set("developer_portal_url", pointer.From(model.Properties.DeveloperPortalUrl)) + d.Set("management_api_url", pointer.From(model.Properties.ManagementApiUrl)) + d.Set("scm_url", pointer.From(model.Properties.ScmUrl)) + d.Set("public_ip_addresses", pointer.From(model.Properties.PublicIPAddresses)) + d.Set("public_ip_address_id", pointer.From(model.Properties.PublicIPAddressId)) + d.Set("private_ip_addresses", pointer.From(model.Properties.PrivateIPAddresses)) + + if err := d.Set("hostname_configuration", flattenDataSourceApiManagementHostnameConfigurations(model.Properties.HostnameConfigurations)); err != nil { return fmt.Errorf("setting `hostname_configuration`: %+v", err) } - if err := d.Set("additional_location", flattenDataSourceApiManagementAdditionalLocations(props.AdditionalLocations)); err != nil { + if err := d.Set("additional_location", flattenDataSourceApiManagementAdditionalLocations(model.Properties.AdditionalLocations)); err != nil { return fmt.Errorf("setting `additional_location`: %+v", err) } - } - - d.Set("sku_name", flattenApiManagementServiceSkuName(resp.Sku)) - tenantAccess := make([]interface{}, 0) - if resp.Sku.Name != apimanagement.SkuTypeConsumption { - tenantAccessInformationContract, err := tenantAccessClient.ListSecrets(ctx, id.ResourceGroup, id.ServiceName, "access") - if err != nil { - if !utils.ResponseWasForbidden(tenantAccessInformationContract.Response) { - return fmt.Errorf("retrieving tenant access properties for %s: %+v", *id, err) + d.Set("sku_name", flattenApiManagementServiceSkuName(&model.Sku)) + + tenantAccess := make([]interface{}, 0) + if model.Sku.Name != apimanagementservice.SkuTypeConsumption { + tenantAccessServiceId := tenantaccess.NewAccessID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, "access") + tenantAccessInformationContract, err := tenantAccessClient.ListSecrets(ctx, tenantAccessServiceId) + if err != nil { + if !response.WasForbidden(tenantAccessInformationContract.HttpResponse) { + return fmt.Errorf("retrieving tenant access properties for %s: %+v", id, err) + } + } else { + tenantAccess = flattenApiManagementTenantAccessSettings(*tenantAccessInformationContract.Model) } - } else { - tenantAccess = flattenApiManagementTenantAccessSettings(tenantAccessInformationContract) } - } - if err := d.Set("tenant_access", tenantAccess); err != nil { - return fmt.Errorf("setting `tenant_access`: %+v", err) + if err := d.Set("tenant_access", tenantAccess); err != nil { + return fmt.Errorf("setting `tenant_access`: %+v", err) + } + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } -func flattenDataSourceApiManagementHostnameConfigurations(input *[]apimanagement.HostnameConfiguration) []interface{} { +func flattenDataSourceApiManagementHostnameConfigurations(input *[]apimanagementservice.HostnameConfiguration) []interface{} { if input == nil { return []interface{}{} } @@ -327,36 +328,30 @@ func flattenDataSourceApiManagementHostnameConfigurations(input *[]apimanagement for _, config := range *input { output := make(map[string]interface{}) - if config.HostName != nil { - output["host_name"] = *config.HostName - } + output["host_name"] = config.HostName - if config.NegotiateClientCertificate != nil { - output["negotiate_client_certificate"] = *config.NegotiateClientCertificate - } + output["negotiate_client_certificate"] = pointer.From(config.NegotiateClientCertificate) - if config.KeyVaultID != nil { - output["key_vault_id"] = *config.KeyVaultID - } + output["key_vault_id"] = pointer.From(config.KeyVaultId) switch strings.ToLower(string(config.Type)) { - case strings.ToLower(string(apimanagement.HostnameTypeProxy)): + case strings.ToLower(string(apimanagementservice.HostnameTypeProxy)): // only set SSL binding for proxy types if config.DefaultSslBinding != nil { output["default_ssl_binding"] = *config.DefaultSslBinding } proxyResults = append(proxyResults, output) - case strings.ToLower(string(apimanagement.HostnameTypeManagement)): + case strings.ToLower(string(apimanagementservice.HostnameTypeManagement)): managementResults = append(managementResults, output) - case strings.ToLower(string(apimanagement.HostnameTypePortal)): + case strings.ToLower(string(apimanagementservice.HostnameTypePortal)): portalResults = append(portalResults, output) - case strings.ToLower(string(apimanagement.HostnameTypeDeveloperPortal)): + case strings.ToLower(string(apimanagementservice.HostnameTypeDeveloperPortal)): developerPortalResults = append(developerPortalResults, output) - case strings.ToLower(string(apimanagement.HostnameTypeScm)): + case strings.ToLower(string(apimanagementservice.HostnameTypeScm)): scmResults = append(scmResults, output) } } @@ -372,45 +367,20 @@ func flattenDataSourceApiManagementHostnameConfigurations(input *[]apimanagement } } -func flattenDataSourceApiManagementAdditionalLocations(input *[]apimanagement.AdditionalLocation) []interface{} { +func flattenDataSourceApiManagementAdditionalLocations(input *[]apimanagementservice.AdditionalLocation) []interface{} { results := make([]interface{}, 0) if input == nil { return results } for _, prop := range *input { - var capacity *int32 - if prop.Sku.Capacity != nil { - capacity = prop.Sku.Capacity - } - - var publicIpAddresses []string - if prop.PublicIPAddresses != nil { - publicIpAddresses = *prop.PublicIPAddresses - } - - publicIpAddressId := "" - if prop.PublicIPAddressID != nil { - publicIpAddressId = *prop.PublicIPAddressID - } - - var privateIpAddresses []string - if prop.PrivateIPAddresses != nil { - privateIpAddresses = *prop.PrivateIPAddresses - } - - gatewayRegionalUrl := "" - if prop.GatewayRegionalURL != nil { - gatewayRegionalUrl = *prop.GatewayRegionalURL - } - results = append(results, map[string]interface{}{ - "capacity": capacity, - "gateway_regional_url": gatewayRegionalUrl, - "location": location.NormalizeNilable(prop.Location), - "private_ip_addresses": privateIpAddresses, - "public_ip_address_id": publicIpAddressId, - "public_ip_addresses": publicIpAddresses, + "capacity": int32(prop.Sku.Capacity), + "gateway_regional_url": pointer.From(prop.GatewayRegionalUrl), + "location": location.NormalizeNilable(pointer.To(prop.Location)), + "private_ip_addresses": pointer.From(prop.PrivateIPAddresses), + "public_ip_address_id": pointer.From(prop.PublicIPAddressId), + "public_ip_addresses": pointer.From(prop.PublicIPAddresses), "zones": zones.FlattenUntyped(prop.Zones), }) } diff --git a/internal/services/apimanagement/api_management_diagnostic_resource.go b/internal/services/apimanagement/api_management_diagnostic_resource.go index cb2aabc19793..a7df4f522c9e 100644 --- a/internal/services/apimanagement/api_management_diagnostic_resource.go +++ b/internal/services/apimanagement/api_management_diagnostic_resource.go @@ -8,17 +8,18 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/set" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementDiagnostic() *pluginsdk.Resource { @@ -29,7 +30,7 @@ func resourceApiManagementDiagnostic() *pluginsdk.Resource { Delete: resourceApiManagementDiagnosticDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DiagnosticID(id) + _, err := diagnostic.ParseDiagnosticID(id) return err }), @@ -58,7 +59,7 @@ func resourceApiManagementDiagnostic() *pluginsdk.Resource { "api_management_logger_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validate.LoggerID, + ValidateFunc: logger.ValidateLoggerID, }, "sampling_percentage": { @@ -79,9 +80,9 @@ func resourceApiManagementDiagnostic() *pluginsdk.Resource { Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.VerbosityVerbose), - string(apimanagement.VerbosityInformation), - string(apimanagement.VerbosityError), + string(diagnostic.VerbosityVerbose), + string(diagnostic.VerbosityInformation), + string(diagnostic.VerbosityError), }, false), }, @@ -96,9 +97,9 @@ func resourceApiManagementDiagnostic() *pluginsdk.Resource { Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.HTTPCorrelationProtocolNone), - string(apimanagement.HTTPCorrelationProtocolLegacy), - string(apimanagement.HTTPCorrelationProtocolW3C), + string(diagnostic.HTTPCorrelationProtocolNone), + string(diagnostic.HTTPCorrelationProtocolLegacy), + string(diagnostic.HTTPCorrelationProtocolWThreeC), }, false), }, @@ -113,10 +114,10 @@ func resourceApiManagementDiagnostic() *pluginsdk.Resource { "operation_name_format": { Type: pluginsdk.TypeString, Optional: true, - Default: string(apimanagement.OperationNameFormatName), + Default: string(diagnostic.OperationNameFormatName), ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.OperationNameFormatName), - string(apimanagement.OperationNameFormatURL), + string(diagnostic.OperationNameFormatName), + string(diagnostic.OperationNameFormatUrl), }, false), }, }, @@ -129,79 +130,79 @@ func resourceApiManagementDiagnosticCreateUpdate(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewDiagnosticID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("identifier").(string)) + id := diagnostic.NewDiagnosticID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("identifier").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_diagnostic", id.ID()) } } - parameters := apimanagement.DiagnosticContract{ - DiagnosticContractProperties: &apimanagement.DiagnosticContractProperties{ - LoggerID: utils.String(d.Get("api_management_logger_id").(string)), - OperationNameFormat: apimanagement.OperationNameFormat(d.Get("operation_name_format").(string)), + parameters := diagnostic.DiagnosticContract{ + Properties: &diagnostic.DiagnosticContractProperties{ + LoggerId: d.Get("api_management_logger_id").(string), + OperationNameFormat: pointer.To(diagnostic.OperationNameFormat(d.Get("operation_name_format").(string))), }, } if samplingPercentage, ok := d.GetOk("sampling_percentage"); ok { - parameters.Sampling = &apimanagement.SamplingSettings{ - SamplingType: apimanagement.SamplingTypeFixed, - Percentage: utils.Float(samplingPercentage.(float64)), + parameters.Properties.Sampling = &diagnostic.SamplingSettings{ + SamplingType: pointer.To(diagnostic.SamplingTypeFixed), + Percentage: pointer.To(samplingPercentage.(float64)), } } else { - parameters.Sampling = nil + parameters.Properties.Sampling = nil } if alwaysLogErrors, ok := d.GetOk("always_log_errors"); ok && alwaysLogErrors.(bool) { - parameters.AlwaysLog = apimanagement.AlwaysLogAllErrors + parameters.Properties.AlwaysLog = pointer.To(diagnostic.AlwaysLogAllErrors) } if verbosity, ok := d.GetOk("verbosity"); ok { - parameters.Verbosity = apimanagement.Verbosity(verbosity.(string)) + parameters.Properties.Verbosity = pointer.To(diagnostic.Verbosity(verbosity.(string))) } //lint:ignore SA1019 SDKv2 migration - staticcheck's own linter directives are currently being ignored under golanci-lint if logClientIP, exists := d.GetOkExists("log_client_ip"); exists { //nolint:staticcheck - parameters.LogClientIP = utils.Bool(logClientIP.(bool)) + parameters.Properties.LogClientIP = pointer.To(logClientIP.(bool)) } if httpCorrelationProtocol, ok := d.GetOk("http_correlation_protocol"); ok { - parameters.HTTPCorrelationProtocol = apimanagement.HTTPCorrelationProtocol(httpCorrelationProtocol.(string)) + parameters.Properties.HTTPCorrelationProtocol = pointer.To(diagnostic.HTTPCorrelationProtocol(httpCorrelationProtocol.(string))) } frontendRequest, frontendRequestSet := d.GetOk("frontend_request") frontendResponse, frontendResponseSet := d.GetOk("frontend_response") if frontendRequestSet || frontendResponseSet { - parameters.Frontend = &apimanagement.PipelineDiagnosticSettings{} + parameters.Properties.Frontend = &diagnostic.PipelineDiagnosticSettings{} if frontendRequestSet { - parameters.Frontend.Request = expandApiManagementApiDiagnosticHTTPMessageDiagnostic(frontendRequest.([]interface{})) + parameters.Properties.Frontend.Request = expandApiManagementDiagnosticHTTPMessageDiagnostic(frontendRequest.([]interface{})) } if frontendResponseSet { - parameters.Frontend.Response = expandApiManagementApiDiagnosticHTTPMessageDiagnostic(frontendResponse.([]interface{})) + parameters.Properties.Frontend.Response = expandApiManagementDiagnosticHTTPMessageDiagnostic(frontendResponse.([]interface{})) } } backendRequest, backendRequestSet := d.GetOk("backend_request") backendResponse, backendResponseSet := d.GetOk("backend_response") if backendRequestSet || backendResponseSet { - parameters.Backend = &apimanagement.PipelineDiagnosticSettings{} + parameters.Properties.Backend = &diagnostic.PipelineDiagnosticSettings{} if backendRequestSet { - parameters.Backend.Request = expandApiManagementApiDiagnosticHTTPMessageDiagnostic(backendRequest.([]interface{})) + parameters.Properties.Backend.Request = expandApiManagementDiagnosticHTTPMessageDiagnostic(backendRequest.([]interface{})) } if backendResponseSet { - parameters.Backend.Response = expandApiManagementApiDiagnosticHTTPMessageDiagnostic(backendResponse.([]interface{})) + parameters.Properties.Backend.Response = expandApiManagementDiagnosticHTTPMessageDiagnostic(backendResponse.([]interface{})) } } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.Name, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, diagnostic.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating or updating %s: %+v", id, err) } @@ -215,53 +216,55 @@ func resourceApiManagementDiagnosticRead(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - diagnosticId, err := parse.DiagnosticID(d.Id()) + diagnosticId, err := diagnostic.ParseDiagnosticID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, diagnosticId.ResourceGroup, diagnosticId.ServiceName, diagnosticId.Name) + resp, err := client.Get(ctx, *diagnosticId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Diagnostic %q (Resource Group %q / API Management Service %q) was not found - removing from state!", diagnosticId.Name, diagnosticId.ResourceGroup, diagnosticId.ServiceName) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *diagnosticId) d.SetId("") return nil } - return fmt.Errorf("making Read request for Diagnostic %q (Resource Group %q / API Management Service %q): %+v", diagnosticId.Name, diagnosticId.ResourceGroup, diagnosticId.ServiceName, err) + return fmt.Errorf("retrieving %s: %+v", *diagnosticId, err) } - d.Set("identifier", resp.Name) - d.Set("resource_group_name", diagnosticId.ResourceGroup) + d.Set("resource_group_name", diagnosticId.ResourceGroupName) d.Set("api_management_name", diagnosticId.ServiceName) - d.Set("api_management_logger_id", resp.LoggerID) - if props := resp.DiagnosticContractProperties; props != nil { - if props.Sampling != nil && props.Sampling.Percentage != nil { - d.Set("sampling_percentage", props.Sampling.Percentage) - } - d.Set("always_log_errors", props.AlwaysLog == apimanagement.AlwaysLogAllErrors) - d.Set("verbosity", props.Verbosity) - d.Set("log_client_ip", props.LogClientIP) - d.Set("http_correlation_protocol", props.HTTPCorrelationProtocol) - if frontend := props.Frontend; frontend != nil { - d.Set("frontend_request", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(frontend.Request)) - d.Set("frontend_response", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(frontend.Response)) - } else { - d.Set("frontend_request", nil) - d.Set("frontend_response", nil) - } - if backend := props.Backend; backend != nil { - d.Set("backend_request", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(backend.Request)) - d.Set("backend_response", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(backend.Response)) - } else { - d.Set("backend_request", nil) - d.Set("backend_response", nil) - } - format := string(apimanagement.OperationNameFormatName) - if props.OperationNameFormat != "" { - format = string(props.OperationNameFormat) + if model := resp.Model; model != nil { + d.Set("identifier", pointer.From(model.Name)) + if model.Properties != nil { + d.Set("api_management_logger_id", model.Properties.LoggerId) + if model.Properties.Sampling != nil && model.Properties.Sampling.Percentage != nil { + d.Set("sampling_percentage", pointer.From(model.Properties.Sampling.Percentage)) + } + d.Set("always_log_errors", pointer.From(model.Properties.AlwaysLog) == diagnostic.AlwaysLogAllErrors) + d.Set("verbosity", pointer.From(model.Properties.Verbosity)) + d.Set("log_client_ip", pointer.From(model.Properties.LogClientIP)) + d.Set("http_correlation_protocol", pointer.From(model.Properties.HTTPCorrelationProtocol)) + if frontend := model.Properties.Frontend; frontend != nil { + d.Set("frontend_request", flattenApiManagementDiagnosticHTTPMessageDiagnostic(frontend.Request)) + d.Set("frontend_response", flattenApiManagementDiagnosticHTTPMessageDiagnostic(frontend.Response)) + } else { + d.Set("frontend_request", nil) + d.Set("frontend_response", nil) + } + if backend := model.Properties.Backend; backend != nil { + d.Set("backend_request", flattenApiManagementDiagnosticHTTPMessageDiagnostic(backend.Request)) + d.Set("backend_response", flattenApiManagementDiagnosticHTTPMessageDiagnostic(backend.Response)) + } else { + d.Set("backend_request", nil) + d.Set("backend_response", nil) + } + format := string(diagnostic.OperationNameFormatName) + if model.Properties.OperationNameFormat != nil { + format = string(pointer.From(model.Properties.OperationNameFormat)) + } + d.Set("operation_name_format", format) } - d.Set("operation_name_format", format) } return nil @@ -272,16 +275,134 @@ func resourceApiManagementDiagnosticDelete(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - diagnosticId, err := parse.DiagnosticID(d.Id()) + diagnosticId, err := diagnostic.ParseDiagnosticID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, diagnosticId.ResourceGroup, diagnosticId.ServiceName, diagnosticId.Name, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting Diagnostic %q (Resource Group %q / API Management Service %q): %+v", diagnosticId.Name, diagnosticId.ResourceGroup, diagnosticId.ServiceName, err) + if resp, err := client.Delete(ctx, *diagnosticId, diagnostic.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *diagnosticId, err) } } return nil } + +func expandApiManagementDiagnosticHTTPMessageDiagnostic(input []interface{}) *diagnostic.HTTPMessageDiagnostic { + if len(input) == 0 || input[0] == nil { + return nil + } + + v := input[0].(map[string]interface{}) + + result := &diagnostic.HTTPMessageDiagnostic{ + Body: &diagnostic.BodyDiagnosticSettings{}, + } + + if bodyBytes, ok := v["body_bytes"]; ok { + result.Body.Bytes = pointer.To(int64(bodyBytes.(int))) + } + if headersSetRaw, ok := v["headers_to_log"]; ok { + headersSet := headersSetRaw.(*pluginsdk.Set).List() + headers := []string{} + for _, header := range headersSet { + headers = append(headers, header.(string)) + } + result.Headers = pointer.To(headers) + } + + result.DataMasking = expandApiManagementDataMasking(v["data_masking"].([]interface{})) + + return result +} + +func flattenApiManagementDiagnosticHTTPMessageDiagnostic(input *diagnostic.HTTPMessageDiagnostic) []interface{} { + result := make([]interface{}, 0) + + if input == nil { + return result + } + + diagnostic := map[string]interface{}{} + + if input.Body != nil && input.Body.Bytes != nil { + diagnostic["body_bytes"] = pointer.From(input.Body.Bytes) + } + + if input.Headers != nil { + diagnostic["headers_to_log"] = set.FromStringSlice(*input.Headers) + } + + diagnostic["data_masking"] = flattenApiManagementDataMasking(input.DataMasking) + + result = append(result, diagnostic) + + return result +} + +func expandApiManagementDataMasking(input []interface{}) *diagnostic.DataMasking { + if len(input) == 0 || input[0] == nil { + return nil + } + + inputRaw := input[0].(map[string]interface{}) + return &diagnostic.DataMasking{ + QueryParams: expandApiManagementDataMaskingEntityList(inputRaw["query_params"].([]interface{})), + Headers: expandApiManagementDataMaskingEntityList(inputRaw["headers"].([]interface{})), + } +} + +func expandApiManagementDataMaskingEntityList(input []interface{}) *[]diagnostic.DataMaskingEntity { + if len(input) == 0 || input[0] == nil { + return nil + } + + result := make([]diagnostic.DataMaskingEntity, 0) + for _, v := range input { + entity := v.(map[string]interface{}) + result = append(result, diagnostic.DataMaskingEntity{ + Mode: pointer.To(diagnostic.DataMaskingMode(entity["mode"].(string))), + Value: pointer.To(entity["value"].(string)), + }) + } + return &result +} + +func flattenApiManagementDataMasking(dataMasking *diagnostic.DataMasking) []interface{} { + if dataMasking == nil { + return []interface{}{} + } + + var queryParams, headers []interface{} + if dataMasking.QueryParams != nil { + queryParams = flattenApiManagementDataMaskingEntityList(dataMasking.QueryParams) + } + if dataMasking.Headers != nil { + headers = flattenApiManagementDataMaskingEntityList(dataMasking.Headers) + } + + return []interface{}{ + map[string]interface{}{ + "query_params": queryParams, + "headers": headers, + }, + } +} + +func flattenApiManagementDataMaskingEntityList(dataMaskingList *[]diagnostic.DataMaskingEntity) []interface{} { + if dataMaskingList == nil || len(*dataMaskingList) == 0 { + return []interface{}{} + } + + result := []interface{}{} + + for _, entity := range *dataMaskingList { + result = append(result, map[string]interface{}{ + "mode": pointer.From(entity.Mode), + "value": pointer.From(entity.Value), + }) + } + + return result +} diff --git a/internal/services/apimanagement/api_management_diagnostic_resource_test.go b/internal/services/apimanagement/api_management_diagnostic_resource_test.go index 69841091e9ba..41aa87307cf5 100644 --- a/internal/services/apimanagement/api_management_diagnostic_resource_test.go +++ b/internal/services/apimanagement/api_management_diagnostic_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementDiagnosticResource struct{} @@ -108,17 +108,17 @@ func TestAccApiManagementDiagnostic_completeUpdate(t *testing.T) { } func (ApiManagementDiagnosticResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - diagnosticId, err := parse.DiagnosticID(state.ID) + diagnosticId, err := diagnostic.ParseDiagnosticID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.DiagnosticClient.Get(ctx, diagnosticId.ResourceGroup, diagnosticId.ServiceName, diagnosticId.Name) + resp, err := clients.ApiManagement.DiagnosticClient.Get(ctx, *diagnosticId) if err != nil { - return nil, fmt.Errorf("reading ApiManagement Diagnostic (%s): %+v", diagnosticId.String(), err) + return nil, fmt.Errorf("retrieving %s: %+v", *diagnosticId, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Properties != nil), nil } func (ApiManagementDiagnosticResource) template(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_email_template_resource.go b/internal/services/apimanagement/api_management_email_template_resource.go index cb7745005441..0b9943fbe75f 100644 --- a/internal/services/apimanagement/api_management_email_template_resource.go +++ b/internal/services/apimanagement/api_management_email_template_resource.go @@ -8,17 +8,17 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementEmailTemplate() *pluginsdk.Resource { @@ -28,7 +28,7 @@ func resourceApiManagementEmailTemplate() *pluginsdk.Resource { Update: resourceApiManagementEmailTemplateCreateUpdate, Delete: resourceApiManagementEmailTemplateDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.EmailTemplateID(id) + _, err := emailtemplates.ParseTemplateIDInsensitively(id) return err }), @@ -50,20 +50,20 @@ func resourceApiManagementEmailTemplate() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - azure.TitleCase(string(apimanagement.TemplateNameAccountClosedDeveloper)), - azure.TitleCase(string(apimanagement.TemplateNameApplicationApprovedNotificationMessage)), - azure.TitleCase(string(apimanagement.TemplateNameConfirmSignUpIdentityDefault)), - azure.TitleCase(string(apimanagement.TemplateNameEmailChangeIdentityDefault)), - azure.TitleCase(string(apimanagement.TemplateNameInviteUserNotificationMessage)), - azure.TitleCase(string(apimanagement.TemplateNameNewCommentNotificationMessage)), - azure.TitleCase(string(apimanagement.TemplateNameNewDeveloperNotificationMessage)), - azure.TitleCase(string(apimanagement.TemplateNameNewIssueNotificationMessage)), - azure.TitleCase(string(apimanagement.TemplateNamePasswordResetByAdminNotificationMessage)), - azure.TitleCase(string(apimanagement.TemplateNamePasswordResetIdentityDefault)), - azure.TitleCase(string(apimanagement.TemplateNamePurchaseDeveloperNotificationMessage)), - azure.TitleCase(string(apimanagement.TemplateNameQuotaLimitApproachingDeveloperNotificationMessage)), - azure.TitleCase(string(apimanagement.TemplateNameRejectDeveloperNotificationMessage)), - azure.TitleCase(string(apimanagement.TemplateNameRequestDeveloperNotificationMessage)), + azure.TitleCase(string(emailtemplates.TemplateNameAccountClosedDeveloper)), + azure.TitleCase(string(emailtemplates.TemplateNameApplicationApprovedNotificationMessage)), + azure.TitleCase(string(emailtemplates.TemplateNameConfirmSignUpIdentityDefault)), + azure.TitleCase(string(emailtemplates.TemplateNameEmailChangeIdentityDefault)), + azure.TitleCase(string(emailtemplates.TemplateNameInviteUserNotificationMessage)), + azure.TitleCase(string(emailtemplates.TemplateNameNewCommentNotificationMessage)), + azure.TitleCase(string(emailtemplates.TemplateNameNewDeveloperNotificationMessage)), + azure.TitleCase(string(emailtemplates.TemplateNameNewIssueNotificationMessage)), + azure.TitleCase(string(emailtemplates.TemplateNamePasswordResetByAdminNotificationMessage)), + azure.TitleCase(string(emailtemplates.TemplateNamePasswordResetIdentityDefault)), + azure.TitleCase(string(emailtemplates.TemplateNamePurchaseDeveloperNotificationMessage)), + azure.TitleCase(string(emailtemplates.TemplateNameQuotaLimitApproachingDeveloperNotificationMessage)), + azure.TitleCase(string(emailtemplates.TemplateNameRejectDeveloperNotificationMessage)), + azure.TitleCase(string(emailtemplates.TemplateNameRequestDeveloperNotificationMessage)), }, false), }, "body": { @@ -89,41 +89,39 @@ func resourceApiManagementEmailTemplate() *pluginsdk.Resource { } func resourceApiManagementEmailTemplateCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ApiManagement.EmailTemplateClient + client := meta.(*clients.Client).ApiManagement.EmailTemplatesClient ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) subscriptionId := meta.(*clients.Client).Account.SubscriptionId defer cancel() - resourceGroup := d.Get("resource_group_name").(string) - serviceName := d.Get("api_management_name").(string) - templateName := apimanagement.TemplateName(d.Get("template_name").(string)) - - id := parse.NewEmailTemplateID(subscriptionId, resourceGroup, serviceName, d.Get("template_name").(string)) + id := emailtemplates.NewTemplateID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), emailtemplates.TemplateName(d.Get("template_name").(string))) if d.IsNewResource() { - existing, err := client.Get(ctx, resourceGroup, serviceName, templateName) + existing, err := client.EmailTemplateGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } // in case the template has been edited (is not default anymore) this errors and the resource should be imported manually into the state (terraform import). - if !utils.ResponseWasNotFound(existing.Response) && (existing.IsDefault != nil && !*existing.IsDefault) { - return tf.ImportAsExistsError("azurerm_api_management_email_template", id.ID()) + if !response.WasNotFound(existing.HttpResponse) { + if model := existing.Model; model != nil && model.Properties != nil && model.Properties.IsDefault != nil && !*model.Properties.IsDefault { + return tf.ImportAsExistsError("azurerm_api_management_email_template", id.ID()) + } } } subject := d.Get("subject").(string) body := d.Get("body").(string) - emailTemplateUpdateParameters := apimanagement.EmailTemplateUpdateParameters{ - EmailTemplateUpdateParameterProperties: &apimanagement.EmailTemplateUpdateParameterProperties{ - Subject: utils.String(subject), - Body: utils.String(body), + emailTemplateUpdateParameters := emailtemplates.EmailTemplateUpdateParameters{ + Properties: &emailtemplates.EmailTemplateUpdateParameterProperties{ + Subject: pointer.To(subject), + Body: pointer.To(body), }, } - if _, err := client.CreateOrUpdate(ctx, resourceGroup, serviceName, templateName, emailTemplateUpdateParameters, ""); err != nil { + if _, err := client.EmailTemplateCreateOrUpdate(ctx, id, emailTemplateUpdateParameters, emailtemplates.EmailTemplateCreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -133,61 +131,57 @@ func resourceApiManagementEmailTemplateCreateUpdate(d *pluginsdk.ResourceData, m } func resourceApiManagementEmailTemplateRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ApiManagement.EmailTemplateClient + client := meta.(*clients.Client).ApiManagement.EmailTemplatesClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.EmailTemplateID(d.Id()) + id, err := emailtemplates.ParseTemplateIDInsensitively(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - - templateName := apimanagement.TemplateName(id.TemplateName) - - resp, err := client.Get(ctx, resourceGroup, serviceName, templateName) + templateName := emailtemplates.TemplateName(azure.TitleCase(string(id.TemplateName))) + newId := emailtemplates.NewTemplateID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, templateName) + resp, err := client.EmailTemplateGet(ctx, newId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] %s does not exist - removing from state!", *id) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s does not exist - removing from state!", newId) d.SetId("") return nil } - return fmt.Errorf("retrieving %s: %+v", *id, err) + return fmt.Errorf("retrieving %s: %+v", newId, err) } - d.Set("resource_group_name", resourceGroup) - d.Set("api_management_name", serviceName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("api_management_name", id.ServiceName) d.Set("template_name", templateName) - if properties := resp.EmailTemplateContractProperties; properties != nil { - d.Set("title", properties.Title) - d.Set("description", properties.Description) - d.Set("subject", properties.Subject) - d.Set("body", properties.Body) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("title", pointer.From(model.Properties.Title)) + d.Set("description", pointer.From(model.Properties.Description)) + d.Set("subject", model.Properties.Subject) + d.Set("body", model.Properties.Body) } return nil } func resourceApiManagementEmailTemplateDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ApiManagement.EmailTemplateClient + client := meta.(*clients.Client).ApiManagement.EmailTemplatesClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.EmailTemplateID(d.Id()) + id, err := emailtemplates.ParseTemplateIDInsensitively(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - templateName := apimanagement.TemplateName(id.TemplateName) + templateName := emailtemplates.TemplateName(azure.TitleCase(string(id.TemplateName))) + newId := emailtemplates.NewTemplateID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, templateName) - if resp, err := client.Delete(ctx, resourceGroup, serviceName, templateName, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting %s: %s", *id, err) + if resp, err := client.EmailTemplateDelete(ctx, newId, emailtemplates.EmailTemplateDeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %s", newId, err) } } diff --git a/internal/services/apimanagement/api_management_email_template_resource_test.go b/internal/services/apimanagement/api_management_email_template_resource_test.go index 588fd0e38d95..1669c68e0c98 100644 --- a/internal/services/apimanagement/api_management_email_template_resource_test.go +++ b/internal/services/apimanagement/api_management_email_template_resource_test.go @@ -8,13 +8,13 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementEmailTemplateResource struct{} @@ -74,17 +74,20 @@ func TestAccApiManagementEmailTemplate_update(t *testing.T) { } func (ApiManagementEmailTemplateResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.EmailTemplateID(state.ID) + id, err := emailtemplates.ParseTemplateIDInsensitively(state.ID) if err != nil { return nil, err } - _, err = clients.ApiManagement.EmailTemplateClient.Get(ctx, id.ResourceGroup, id.ServiceName, apimanagement.TemplateName(id.TemplateName)) + templateName := emailtemplates.TemplateName(azure.TitleCase(string(id.TemplateName))) + newId := emailtemplates.NewTemplateID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, templateName) + + _, err = clients.ApiManagement.EmailTemplatesClient.EmailTemplateGet(ctx, newId) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", newId, err) } - return utils.Bool(true), nil + return pointer.To(true), nil } func (r ApiManagementEmailTemplateResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_gateway_api_resource.go b/internal/services/apimanagement/api_management_gateway_api_resource.go index a32af53abb80..155af9e95386 100644 --- a/internal/services/apimanagement/api_management_gateway_api_resource.go +++ b/internal/services/apimanagement/api_management_gateway_api_resource.go @@ -9,15 +9,16 @@ import ( "net/http" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementGatewayApi() *pluginsdk.Resource { @@ -27,7 +28,7 @@ func resourceApiManagementGatewayApi() *pluginsdk.Resource { Delete: resourceApiManagementGatewayApiDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.GatewayApiID(id) + _, err := gatewayapi.ParseGatewayApiID(id) return err }), @@ -38,12 +39,17 @@ func resourceApiManagementGatewayApi() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, + SchemaVersion: 1, + StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ + 0: migration.ApiManagementApiPolicyV0ToV1{}, + }), + Schema: map[string]*pluginsdk.Schema{ "api_id": { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ApiID, + ValidateFunc: api.ValidateApiID, }, "gateway_id": { Type: pluginsdk.TypeString, @@ -60,32 +66,33 @@ func resourceApiManagementGatewayApiCreate(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - apiID, err := parse.ApiID(d.Get("api_id").(string)) + apiID, err := api.ParseApiID(d.Get("api_id").(string)) if err != nil { return fmt.Errorf("parsing `api_id`: %v", err) } - gatewayID, err := parse.GatewayID(d.Get("gateway_id").(string)) + gatewayID, err := gateway.ParseGatewayID(d.Get("gateway_id").(string)) if err != nil { return fmt.Errorf("parsing `gateway_id`: %v", err) } - exists, err := client.GetEntityTag(ctx, gatewayID.ResourceGroup, gatewayID.ServiceName, gatewayID.Name, apiID.Name) + apiName := getApiName(apiID.ApiId) + + id := gatewayapi.NewGatewayApiID(gatewayID.SubscriptionId, gatewayID.ResourceGroupName, gatewayID.ServiceName, gatewayID.GatewayId, apiName) + exists, err := client.GetEntityTag(ctx, id) if err != nil { - if !utils.ResponseWasStatusCode(exists, http.StatusNoContent) { - if !utils.ResponseWasNotFound(exists) { + if !response.WasStatusCode(exists.HttpResponse, http.StatusNoContent) { + if !response.WasNotFound(exists.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", gatewayID, err) } } } - id := parse.NewGatewayApiID(gatewayID.SubscriptionId, gatewayID.ResourceGroup, gatewayID.ServiceName, gatewayID.Name, apiID.Name) - if !utils.ResponseWasNotFound(exists) { + if !response.WasNotFound(exists.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_gateway_api", id.ID()) } - params := &apimanagement.AssociationContract{} - _, err = client.CreateOrUpdate(ctx, gatewayID.ResourceGroup, gatewayID.ServiceName, gatewayID.Name, apiID.Name, params) - if err != nil { + params := gatewayapi.AssociationContract{} + if _, err = client.CreateOrUpdate(ctx, id, params); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } d.SetId(id.ID()) @@ -98,31 +105,34 @@ func resourceApiManagementGatewayApiRead(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.GatewayApiID(d.Id()) + id, err := gatewayapi.ParseGatewayApiID(d.Id()) if err != nil { return err } - apiId := parse.NewApiID(id.SubscriptionId, id.ResourceGroup, id.ServiceName, id.ApiName) - resp, err := client.GetEntityTag(ctx, id.ResourceGroup, id.ServiceName, id.GatewayName, id.ApiName) + apiName := getApiName(id.ApiId) + + apiId := api.NewApiID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, apiName) + gatewayApiId := gatewayapi.NewGatewayApiID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.GatewayId, apiName) + resp, err := client.GetEntityTag(ctx, gatewayApiId) if err != nil { - if utils.ResponseWasNotFound(resp) { - log.Printf("[DEBUG] %s does not exist - removing from state!", id) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s does not exist - removing from state!", gatewayApiId) d.SetId("") return nil } - if utils.ResponseWasStatusCode(resp, http.StatusNoContent) { - log.Printf("[DEBUG] %s returned with No Content status - bypassing and moving on!", id) + if response.WasStatusCode(resp.HttpResponse, http.StatusNoContent) { + log.Printf("[DEBUG] %s returned with No Content status - bypassing and moving on!", gatewayApiId) } else { - return fmt.Errorf("retrieving %s: %+v", id, err) + return fmt.Errorf("retrieving %s: %+v", gatewayApiId, err) } } - if utils.ResponseWasNotFound(resp) { - log.Printf("[DEBUG] %s was not found - removing from state!", id) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - gateway := parse.NewGatewayID(id.SubscriptionId, id.ResourceGroup, id.ServiceName, id.GatewayName) + gateway := gatewayapi.NewGatewayID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.GatewayId) d.Set("api_id", apiId.ID()) d.Set("gateway_id", gateway.ID()) @@ -135,14 +145,17 @@ func resourceApiManagementGatewayApiDelete(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.GatewayApiID(d.Id()) + id, err := gatewayapi.ParseGatewayApiID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.GatewayName, id.ApiName); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("removing %s: %+v", id, err) + name := getApiName(id.ApiId) + + newId := gatewayapi.NewGatewayApiID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.GatewayId, name) + if resp, err := client.Delete(ctx, newId); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("removing %s: %+v", newId, err) } } diff --git a/internal/services/apimanagement/api_management_gateway_api_resource_test.go b/internal/services/apimanagement/api_management_gateway_api_resource_test.go index 20aae17da726..79a7041fc151 100644 --- a/internal/services/apimanagement/api_management_gateway_api_resource_test.go +++ b/internal/services/apimanagement/api_management_gateway_api_resource_test.go @@ -9,12 +9,13 @@ import ( "net/http" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementGatewayAPIResource struct{} @@ -50,21 +51,21 @@ func TestAccApiManagementGatewayApi_requiresImport(t *testing.T) { } func (ApiManagementGatewayAPIResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.GatewayApiID(state.ID) + id, err := gatewayapi.ParseGatewayApiID(state.ID) if err != nil { return nil, err } - if resp, err := clients.ApiManagement.GatewayApisClient.GetEntityTag(ctx, id.ResourceGroup, id.ServiceName, id.GatewayName, id.ApiName); err != nil { - if utils.ResponseWasNotFound(resp) { - return nil, fmt.Errorf("reading ApiManagement Gateway (%s): %+v", id, err) + if resp, err := clients.ApiManagement.GatewayApisClient.GetEntityTag(ctx, *id); err != nil { + if response.WasNotFound(resp.HttpResponse) { + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - if !utils.ResponseWasStatusCode(resp, http.StatusNoContent) { - return nil, fmt.Errorf("reading ApiManagement Gateway (%s): %+v", id, err) + if !response.WasStatusCode(resp.HttpResponse, http.StatusNoContent) { + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } } - return utils.Bool(true), nil + return pointer.To(true), nil } func (ApiManagementGatewayAPIResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_gateway_certificate_authority_resource.go b/internal/services/apimanagement/api_management_gateway_certificate_authority_resource.go index 23b7ea1f5e43..8f8ae104b6bf 100644 --- a/internal/services/apimanagement/api_management_gateway_certificate_authority_resource.go +++ b/internal/services/apimanagement/api_management_gateway_certificate_authority_resource.go @@ -8,15 +8,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementGatewayCertificateAuthority() *pluginsdk.Resource { @@ -27,7 +28,7 @@ func resourceApiManagementGatewayCertificateAuthority() *pluginsdk.Resource { Delete: resourceApiManagementGatewayCertificateAuthorityDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.GatewayCertificateAuthorityID(id) + _, err := gatewaycertificateauthority.ParseCertificateAuthorityID(id) return err }), @@ -43,7 +44,7 @@ func resourceApiManagementGatewayCertificateAuthority() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ApiManagementID, + ValidateFunc: apimanagementservice.ValidateServiceID, }, "certificate_name": schemaz.SchemaApiManagementChildName(), @@ -68,28 +69,28 @@ func resourceApiManagementGatewayCertificateAuthorityCreateUpdate(d *pluginsdk.R return fmt.Errorf("parsing `api_management_id`: %v", err) } - id := parse.NewGatewayCertificateAuthorityID(apimId.SubscriptionId, apimId.ResourceGroup, apimId.ServiceName, d.Get("gateway_name").(string), d.Get("certificate_name").(string)) + id := gatewaycertificateauthority.NewCertificateAuthorityID(apimId.SubscriptionId, apimId.ResourceGroup, apimId.ServiceName, d.Get("gateway_name").(string), d.Get("certificate_name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.GatewayName, d.Get("certificate_name").(string)) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_gateway_certificate_authority", id.ID()) } } - parameters := apimanagement.GatewayCertificateAuthorityContract{ - GatewayCertificateAuthorityContractProperties: &apimanagement.GatewayCertificateAuthorityContractProperties{ - IsTrusted: utils.Bool(d.Get("is_trusted").(bool)), + parameters := gatewaycertificateauthority.GatewayCertificateAuthorityContract{ + Properties: &gatewaycertificateauthority.GatewayCertificateAuthorityContractProperties{ + IsTrusted: pointer.To(d.Get("is_trusted").(bool)), }, } - _, err = client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, d.Get("gateway_name").(string), d.Get("certificate_name").(string), parameters, "") + _, err = client.CreateOrUpdate(ctx, id, parameters, gatewaycertificateauthority.CreateOrUpdateOperationOptions{}) if err != nil { return fmt.Errorf("creating or updating %s: %+v", id, err) } @@ -104,14 +105,14 @@ func resourceApiManagementGatewayCertificateAuthorityRead(d *pluginsdk.ResourceD ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.GatewayCertificateAuthorityID(d.Id()) + id, err := gatewaycertificateauthority.ParseCertificateAuthorityID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.GatewayName, id.CertificateAuthorityName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("%s was not found - removing from state!", *id) d.SetId("") return nil @@ -120,14 +121,16 @@ func resourceApiManagementGatewayCertificateAuthorityRead(d *pluginsdk.ResourceD return fmt.Errorf("making read request for %s: %+v", *id, err) } - apimId := parse.NewApiManagementID(id.SubscriptionId, id.ResourceGroup, id.ServiceName) + apimId := apimanagementservice.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName) - d.Set("certificate_name", resp.Name) d.Set("api_management_id", apimId.ID()) - d.Set("gateway_name", id.GatewayName) + d.Set("gateway_name", id.GatewayId) - if properties := resp.GatewayCertificateAuthorityContractProperties; properties != nil { - d.Set("is_trusted", properties.IsTrusted) + if model := resp.Model; model != nil { + d.Set("certificate_name", pointer.From(model.Name)) + if model.Properties != nil { + d.Set("is_trusted", pointer.From(model.Properties.IsTrusted)) + } } return nil @@ -138,14 +141,14 @@ func resourceApiManagementGatewayCertificateAuthorityDelete(d *pluginsdk.Resourc ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.GatewayCertificateAuthorityID(d.Id()) + id, err := gatewaycertificateauthority.ParseCertificateAuthorityID(d.Id()) if err != nil { return err } log.Printf("[DEBUG] Deleting %s", *id) - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.GatewayName, id.CertificateAuthorityName, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id, gatewaycertificateauthority.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_gateway_certificate_authority_resource_test.go b/internal/services/apimanagement/api_management_gateway_certificate_authority_resource_test.go index ae72590c4be2..eb50c80b907f 100644 --- a/internal/services/apimanagement/api_management_gateway_certificate_authority_resource_test.go +++ b/internal/services/apimanagement/api_management_gateway_certificate_authority_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementGatewayCertificateAuthorityResource struct{} @@ -90,17 +90,17 @@ func TestAccApiManagementGatewayCertificateAuthority_update(t *testing.T) { } func (ApiManagementGatewayCertificateAuthorityResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.GatewayCertificateAuthorityID(state.ID) + id, err := gatewaycertificateauthority.ParseCertificateAuthorityID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.GatewayCertificateAuthorityClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.GatewayName, id.CertificateAuthorityName) + resp, err := clients.ApiManagement.GatewayCertificateAuthorityClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading Api Management Gateway Certificate Authority (%s): %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementGatewayCertificateAuthorityResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_gateway_data_source.go b/internal/services/apimanagement/api_management_gateway_data_source.go index 77471f6fa4b2..54b0a253aad2 100644 --- a/internal/services/apimanagement/api_management_gateway_data_source.go +++ b/internal/services/apimanagement/api_management_gateway_data_source.go @@ -7,13 +7,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceApiManagementGateway() *pluginsdk.Resource { @@ -30,7 +31,7 @@ func dataSourceApiManagementGateway() *pluginsdk.Resource { "api_management_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validate.ApiManagementID, + ValidateFunc: apimanagementservice.ValidateServiceID, }, "description": { @@ -71,35 +72,38 @@ func dataSourceApiManagementGatewayRead(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - apimId, err := parse.ApiManagementID(d.Get("api_management_id").(string)) + apimId, err := apimanagementservice.ParseServiceID(d.Get("api_management_id").(string)) if err != nil { return fmt.Errorf("parsing `api_management_id`: %v", err) } - id := parse.NewGatewayID(apimId.SubscriptionId, apimId.ResourceGroup, apimId.ServiceName, d.Get("name").(string)) + id := gateway.NewGatewayID(apimId.SubscriptionId, apimId.ResourceGroupName, apimId.ServiceName, d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("making read request %s: %+v", id, err) } - _, err = parse.GatewayID(*resp.ID) - if err != nil { - return fmt.Errorf("parsing Gateway ID %q", *resp.ID) + if resp.Model != nil { + _, err = gateway.ParseGatewayID(*resp.Model.Id) + if err != nil { + return fmt.Errorf("parsing Gateway ID %q", *resp.Model.Id) + } } - d.SetId(id.ID()) - d.Set("name", resp.Name) d.Set("api_management_id", apimId.ID()) - if properties := resp.GatewayContractProperties; properties != nil { - d.Set("description", properties.Description) - d.Set("location_data", flattenApiManagementGatewayLocationData(properties.LocationData)) + if model := resp.Model; model != nil { + d.Set("name", pointer.From(model.Name)) + if model.Properties != nil { + d.Set("description", pointer.From(model.Properties.Description)) + d.Set("location_data", flattenApiManagementGatewayLocationData(model.Properties.LocationData)) + } } return nil diff --git a/internal/services/apimanagement/api_management_gateway_host_name_configuration_data_source.go b/internal/services/apimanagement/api_management_gateway_host_name_configuration_data_source.go index cb417df909cc..fdf2b40677d4 100644 --- a/internal/services/apimanagement/api_management_gateway_host_name_configuration_data_source.go +++ b/internal/services/apimanagement/api_management_gateway_host_name_configuration_data_source.go @@ -7,13 +7,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceApiManagementGatewayHostNameConfiguration() *pluginsdk.Resource { @@ -33,7 +35,7 @@ func dataSourceApiManagementGatewayHostNameConfiguration() *pluginsdk.Resource { "api_management_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validate.ApiManagementID, + ValidateFunc: apimanagementservice.ValidateServiceID, }, "gateway_name": schemaz.SchemaApiManagementChildDataSourceName(), @@ -76,41 +78,40 @@ func dataSourceApiManagementGatewayHostnameConfigurationRead(d *pluginsdk.Resour ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - apimId, err := parse.ApiManagementID(d.Get("api_management_id").(string)) + apimId, err := apimanagementservice.ParseServiceID(d.Get("api_management_id").(string)) if err != nil { return fmt.Errorf("parsing `api_management_id`: %v", err) } - id := parse.NewGatewayHostNameConfigurationID(apimId.SubscriptionId, apimId.ResourceGroup, apimId.ServiceName, d.Get("gateway_name").(string), d.Get("name").(string)) + id := gatewayhostnameconfiguration.NewHostnameConfigurationID(apimId.SubscriptionId, apimId.ResourceGroupName, apimId.ServiceName, d.Get("gateway_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.GatewayName, id.HostnameConfigurationName) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("making read request %s: %+v", id, err) } - _, err = parse.GatewayHostNameConfigurationID(*resp.ID) - if err != nil { - return fmt.Errorf("parsing GatewayHostnameConfiguration ID %q", *resp.ID) + if model := resp.Model; model != nil { + d.Set("name", pointer.From(model.Name)) + _, err = gatewayhostnameconfiguration.ParseHostnameConfigurationID(*model.Id) + if err != nil { + return fmt.Errorf("parsing GatewayHostnameConfiguration ID %q", *model.Id) + } + + d.Set("host_name", model.Properties.Hostname) + d.Set("certificate_id", model.Properties.CertificateId) + d.Set("request_client_certificate_enabled", model.Properties.NegotiateClientCertificate) + d.Set("tls10_enabled", model.Properties.Tls10Enabled) + d.Set("tls11_enabled", model.Properties.Tls11Enabled) + d.Set("http2_enabled", model.Properties.HTTP2Enabled) } d.SetId(id.ID()) - - d.Set("name", resp.Name) d.Set("api_management_id", apimId.ID()) - d.Set("gateway_name", id.GatewayName) - - if properties := resp.GatewayHostnameConfigurationContractProperties; properties != nil { - d.Set("host_name", properties.Hostname) - d.Set("certificate_id", properties.CertificateID) - d.Set("request_client_certificate_enabled", properties.NegotiateClientCertificate) - d.Set("tls10_enabled", properties.TLS10Enabled) - d.Set("tls11_enabled", properties.TLS11Enabled) - d.Set("http2_enabled", properties.HTTP2Enabled) - } + d.Set("gateway_name", id.GatewayId) return nil } diff --git a/internal/services/apimanagement/api_management_gateway_host_name_configuration_resource.go b/internal/services/apimanagement/api_management_gateway_host_name_configuration_resource.go index 40364b7f2a1f..86ecca308efe 100644 --- a/internal/services/apimanagement/api_management_gateway_host_name_configuration_resource.go +++ b/internal/services/apimanagement/api_management_gateway_host_name_configuration_resource.go @@ -8,16 +8,17 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementGatewayHostNameConfiguration() *pluginsdk.Resource { @@ -28,7 +29,7 @@ func resourceApiManagementGatewayHostNameConfiguration() *pluginsdk.Resource { Delete: resourceApiManagementGatewayHostNameConfigurationDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.GatewayHostNameConfigurationID(id) + _, err := gatewayhostnameconfiguration.ParseHostnameConfigurationID(id) return err }), @@ -46,7 +47,7 @@ func resourceApiManagementGatewayHostNameConfiguration() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ApiManagementID, + ValidateFunc: apimanagementservice.ValidateServiceID, }, "gateway_name": schemaz.SchemaApiManagementChildName(), @@ -92,38 +93,38 @@ func resourceApiManagementGatewayHostNameConfigurationCreateUpdate(d *pluginsdk. ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - apimId, err := parse.ApiManagementID(d.Get("api_management_id").(string)) + apimId, err := apimanagementservice.ParseServiceID(d.Get("api_management_id").(string)) if err != nil { return fmt.Errorf("parsing `api_management_id`: %v", err) } - id := parse.NewGatewayHostNameConfigurationID(apimId.SubscriptionId, apimId.ResourceGroup, apimId.ServiceName, d.Get("gateway_name").(string), d.Get("name").(string)) + id := gatewayhostnameconfiguration.NewHostnameConfigurationID(apimId.SubscriptionId, apimId.ResourceGroupName, apimId.ServiceName, d.Get("gateway_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.GatewayName, d.Get("name").(string)) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_gateway_host_name_configuration", id.ID()) } } - parameters := apimanagement.GatewayHostnameConfigurationContract{ - GatewayHostnameConfigurationContractProperties: &apimanagement.GatewayHostnameConfigurationContractProperties{ - Hostname: utils.String(d.Get("host_name").(string)), - CertificateID: utils.String(d.Get("certificate_id").(string)), - NegotiateClientCertificate: utils.Bool(d.Get("request_client_certificate_enabled").(bool)), - TLS10Enabled: utils.Bool(d.Get("tls10_enabled").(bool)), - TLS11Enabled: utils.Bool(d.Get("tls11_enabled").(bool)), - HTTP2Enabled: utils.Bool(d.Get("http2_enabled").(bool)), + parameters := gatewayhostnameconfiguration.GatewayHostnameConfigurationContract{ + Properties: &gatewayhostnameconfiguration.GatewayHostnameConfigurationContractProperties{ + Hostname: pointer.To(d.Get("host_name").(string)), + CertificateId: pointer.To(d.Get("certificate_id").(string)), + NegotiateClientCertificate: pointer.To(d.Get("request_client_certificate_enabled").(bool)), + Tls10Enabled: pointer.To(d.Get("tls10_enabled").(bool)), + Tls11Enabled: pointer.To(d.Get("tls11_enabled").(bool)), + HTTP2Enabled: pointer.To(d.Get("http2_enabled").(bool)), }, } - _, err = client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, d.Get("gateway_name").(string), d.Get("name").(string), parameters, "") + _, err = client.CreateOrUpdate(ctx, id, parameters, gatewayhostnameconfiguration.CreateOrUpdateOperationOptions{}) if err != nil { return fmt.Errorf("creating or updating %s: %+v", id, err) } @@ -138,14 +139,14 @@ func resourceApiManagementGatewayHostNameConfigurationRead(d *pluginsdk.Resource ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.GatewayHostNameConfigurationID(d.Id()) + id, err := gatewayhostnameconfiguration.ParseHostnameConfigurationID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.GatewayName, id.HostnameConfigurationName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("%s was not found - removing from state!", *id) d.SetId("") return nil @@ -154,19 +155,21 @@ func resourceApiManagementGatewayHostNameConfigurationRead(d *pluginsdk.Resource return fmt.Errorf("making read request for %s: %+v", *id, err) } - apimId := parse.NewApiManagementID(id.SubscriptionId, id.ResourceGroup, id.ServiceName) + apimId := apimanagementservice.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName) - d.Set("name", resp.Name) d.Set("api_management_id", apimId.ID()) - d.Set("gateway_name", id.GatewayName) - - if properties := resp.GatewayHostnameConfigurationContractProperties; properties != nil { - d.Set("host_name", properties.Hostname) - d.Set("certificate_id", properties.CertificateID) - d.Set("request_client_certificate_enabled", properties.NegotiateClientCertificate) - d.Set("tls10_enabled", properties.TLS10Enabled) - d.Set("tls11_enabled", properties.TLS11Enabled) - d.Set("http2_enabled", properties.HTTP2Enabled) + d.Set("gateway_name", id.GatewayId) + + if model := resp.Model; model != nil { + d.Set("name", pointer.From(model.Name)) + if properties := model.Properties; properties != nil { + d.Set("host_name", pointer.From(properties.Hostname)) + d.Set("certificate_id", pointer.From(properties.CertificateId)) + d.Set("request_client_certificate_enabled", pointer.From(properties.NegotiateClientCertificate)) + d.Set("tls10_enabled", pointer.From(properties.Tls10Enabled)) + d.Set("tls11_enabled", pointer.From(properties.Tls11Enabled)) + d.Set("http2_enabled", pointer.From(properties.HTTP2Enabled)) + } } return nil @@ -177,14 +180,14 @@ func resourceApiManagementGatewayHostNameConfigurationDelete(d *pluginsdk.Resour ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.GatewayHostNameConfigurationID(d.Id()) + id, err := gatewayhostnameconfiguration.ParseHostnameConfigurationID(d.Id()) if err != nil { return err } log.Printf("[DEBUG] Deleting %s", *id) - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.GatewayName, id.HostnameConfigurationName, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id, gatewayhostnameconfiguration.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_gateway_host_name_configuration_resource_test.go b/internal/services/apimanagement/api_management_gateway_host_name_configuration_resource_test.go index b3f7a994abaa..f39f62333f0e 100644 --- a/internal/services/apimanagement/api_management_gateway_host_name_configuration_resource_test.go +++ b/internal/services/apimanagement/api_management_gateway_host_name_configuration_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementGatewayHostNameConfigurationResource struct{} @@ -93,17 +93,17 @@ func TestAccApiManagementGatewayHostNameConfiguration_update(t *testing.T) { } func (ApiManagementGatewayHostNameConfigurationResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.GatewayHostNameConfigurationID(state.ID) + id, err := gatewayhostnameconfiguration.ParseHostnameConfigurationID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.GatewayHostNameConfigurationClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.GatewayName, id.HostnameConfigurationName) + resp, err := clients.ApiManagement.GatewayHostNameConfigurationClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading Api Management Gateway Certificate Authority (%s): %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementGatewayHostNameConfigurationResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_gateway_resource.go b/internal/services/apimanagement/api_management_gateway_resource.go index 8b95535fbac8..ab0030fd5193 100644 --- a/internal/services/apimanagement/api_management_gateway_resource.go +++ b/internal/services/apimanagement/api_management_gateway_resource.go @@ -8,15 +8,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementGateway() *pluginsdk.Resource { @@ -27,7 +27,7 @@ func resourceApiManagementGateway() *pluginsdk.Resource { Delete: resourceApiManagementGatewayDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.GatewayID(id) + _, err := gateway.ParseGatewayID(id) return err }), @@ -45,7 +45,7 @@ func resourceApiManagementGateway() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ApiManagementID, + ValidateFunc: apimanagementservice.ValidateServiceID, }, "description": { @@ -87,22 +87,22 @@ func resourceApiManagementGatewayCreateUpdate(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - apimId, err := parse.ApiManagementID(d.Get("api_management_id").(string)) + apimId, err := apimanagementservice.ParseServiceID(d.Get("api_management_id").(string)) if err != nil { return fmt.Errorf("parsing `api_management_id`: %v", err) } - id := parse.NewGatewayID(apimId.SubscriptionId, apimId.ResourceGroup, apimId.ServiceName, d.Get("name").(string)) + id := gateway.NewGatewayID(apimId.SubscriptionId, apimId.ResourceGroupName, apimId.ServiceName, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("making read request %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_gateway", id.ID()) } } @@ -110,14 +110,14 @@ func resourceApiManagementGatewayCreateUpdate(d *pluginsdk.ResourceData, meta in description := d.Get("description").(string) locationData := expandApiManagementGatewayLocationData(d.Get("location_data").([]interface{})) - parameters := apimanagement.GatewayContract{ - GatewayContractProperties: &apimanagement.GatewayContractProperties{ - Description: utils.String(description), + parameters := gateway.GatewayContract{ + Properties: &gateway.GatewayContractProperties{ + Description: pointer.To(description), LocationData: locationData, }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.Name, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, gateway.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating or updating %s: %+v", id, err) } @@ -131,19 +131,16 @@ func resourceApiManagementGatewayRead(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.GatewayID(d.Id()) + id, err := gateway.ParseGatewayID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - name := id.Name - apimId := parse.NewApiManagementID(id.SubscriptionId, id.ResourceGroup, id.ServiceName) + apimId := apimanagementservice.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName) - resp, err := client.Get(ctx, resourceGroup, serviceName, name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Gateway %q (Resource Group %q / API Management Service %q) was not found - removing from state!", name, resourceGroup, serviceName) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil } @@ -151,12 +148,13 @@ func resourceApiManagementGatewayRead(d *pluginsdk.ResourceData, meta interface{ return fmt.Errorf("making read request for %s: %+v", id, err) } - d.Set("name", resp.Name) + d.Set("name", id.GatewayId) d.Set("api_management_id", apimId.ID()) - if properties := resp.GatewayContractProperties; properties != nil { - d.Set("description", properties.Description) - d.Set("location_data", flattenApiManagementGatewayLocationData(properties.LocationData)) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("description", pointer.From(model.Properties.Description)) + d.Set("location_data", flattenApiManagementGatewayLocationData(model.Properties.LocationData)) + } return nil @@ -167,16 +165,13 @@ func resourceApiManagementGatewayDelete(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.GatewayID(d.Id()) + id, err := gateway.ParseGatewayID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - name := id.Name - if resp, err := client.Delete(ctx, resourceGroup, serviceName, name, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id, gateway.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", id, err) } } @@ -184,40 +179,40 @@ func resourceApiManagementGatewayDelete(d *pluginsdk.ResourceData, meta interfac return nil } -func expandApiManagementGatewayLocationData(input []interface{}) *apimanagement.ResourceLocationDataContract { +func expandApiManagementGatewayLocationData(input []interface{}) *gateway.ResourceLocationDataContract { if len(input) == 0 { return nil } - locationData := apimanagement.ResourceLocationDataContract{} + locationData := gateway.ResourceLocationDataContract{} vs := input[0].(map[string]interface{}) for k, v := range vs { switch k { case "name": - locationData.Name = utils.String(v.(string)) + locationData.Name = v.(string) case "city": - locationData.City = utils.String(v.(string)) + locationData.City = pointer.To(v.(string)) case "district": - locationData.District = utils.String(v.(string)) + locationData.District = pointer.To(v.(string)) case "region": - locationData.CountryOrRegion = utils.String(v.(string)) + locationData.CountryOrRegion = pointer.To(v.(string)) } } return &locationData } -func flattenApiManagementGatewayLocationData(input *apimanagement.ResourceLocationDataContract) []interface{} { +func flattenApiManagementGatewayLocationData(input *gateway.ResourceLocationDataContract) []interface{} { if input == nil { return []interface{}{} } locationData := map[string]interface{}{ - "name": utils.NormalizeNilableString(input.Name), - "city": utils.NormalizeNilableString(input.City), - "region": utils.NormalizeNilableString(input.CountryOrRegion), - "district": utils.NormalizeNilableString(input.District), + "name": input.Name, + "city": pointer.From(input.City), + "region": pointer.From(input.CountryOrRegion), + "district": pointer.From(input.District), } return []interface{}{locationData} diff --git a/internal/services/apimanagement/api_management_gateway_resource_test.go b/internal/services/apimanagement/api_management_gateway_resource_test.go index 5eca1ad8f5bb..5271bddb673e 100644 --- a/internal/services/apimanagement/api_management_gateway_resource_test.go +++ b/internal/services/apimanagement/api_management_gateway_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementGatewayResource struct{} @@ -113,17 +113,17 @@ func TestAccApiManagementGateway_update(t *testing.T) { } func (ApiManagementGatewayResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.GatewayID(state.ID) + id, err := gateway.ParseGatewayID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.GatewayClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := clients.ApiManagement.GatewayClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading ApiManagementGateway (%s): %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementGatewayResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_global_schema_resource.go b/internal/services/apimanagement/api_management_global_schema_resource.go index 3468ad634106..4bfeaea50c67 100644 --- a/internal/services/apimanagement/api_management_global_schema_resource.go +++ b/internal/services/apimanagement/api_management_global_schema_resource.go @@ -87,6 +87,7 @@ func resourceApiManagementGlobalSchemaCreateUpdate(d *pluginsdk.ResourceData, me return tf.ImportAsExistsError("azurerm_api_management_global_schema", id.ID()) } } + payload := schema.GlobalSchemaContract{ Properties: &schema.GlobalSchemaContractProperties{ Description: pointer.To(d.Get("description").(string)), diff --git a/internal/services/apimanagement/api_management_global_schema_resource_test.go b/internal/services/apimanagement/api_management_global_schema_resource_test.go index 7601a1b0cb92..dc63da744ab5 100644 --- a/internal/services/apimanagement/api_management_global_schema_resource_test.go +++ b/internal/services/apimanagement/api_management_global_schema_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementGlobalSchemaResource struct{} @@ -93,10 +93,10 @@ func (ApiManagementGlobalSchemaResource) Exists(ctx context.Context, clients *cl resp, err := clients.ApiManagement.GlobalSchemaClient.GlobalSchemaGet(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading ApiManagement Global Schema (%s): %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.Model.Id != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (r ApiManagementGlobalSchemaResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_group_data_source.go b/internal/services/apimanagement/api_management_group_data_source.go index 5923ce7288c5..87a981a231db 100644 --- a/internal/services/apimanagement/api_management_group_data_source.go +++ b/internal/services/apimanagement/api_management_group_data_source.go @@ -7,13 +7,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceApiManagementGroup() *pluginsdk.Resource { @@ -63,31 +64,27 @@ func dataSourceApiManagementGroupRead(d *pluginsdk.ResourceData, meta interface{ serviceName := d.Get("api_management_name").(string) name := d.Get("name").(string) - resp, err := client.Get(ctx, resourceGroup, serviceName, name) - if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf("Group %q (Resource Group %q / API Management Service %q) was not found", name, resourceGroup, serviceName) - } + id := group.NewGroupID(meta.(*clients.Client).Account.SubscriptionId, resourceGroup, serviceName, name) - return fmt.Errorf("making Read request for Group %q (Resource Group %q / API Management Service %q): %+v", name, resourceGroup, serviceName, err) - } - - id, err := parse.GroupID(*resp.ID) + resp, err := client.Get(ctx, id) if err != nil { - return fmt.Errorf("parsing Group ID %q", *resp.ID) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s does not exist", id) + } + return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) - d.Set("name", resp.Name) + d.Set("name", id.GroupId) d.Set("resource_group_name", resourceGroup) d.Set("api_management_name", serviceName) - if properties := resp.GroupContractProperties; properties != nil { - d.Set("display_name", properties.DisplayName) - d.Set("description", properties.Description) - d.Set("external_id", properties.ExternalID) - d.Set("type", string(properties.Type)) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("display_name", model.Properties.DisplayName) + d.Set("description", pointer.From(model.Properties.Description)) + d.Set("external_id", pointer.From(model.Properties.ExternalId)) + d.Set("type", string(pointer.From(model.Properties.Type))) } return nil diff --git a/internal/services/apimanagement/api_management_group_resource.go b/internal/services/apimanagement/api_management_group_resource.go index 80a93e8f7686..3173a1b7968f 100644 --- a/internal/services/apimanagement/api_management_group_resource.go +++ b/internal/services/apimanagement/api_management_group_resource.go @@ -8,16 +8,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementGroup() *pluginsdk.Resource { @@ -27,7 +27,7 @@ func resourceApiManagementGroup() *pluginsdk.Resource { Update: resourceApiManagementGroupCreateUpdate, Delete: resourceApiManagementGroupDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.GroupID(id) + _, err := group.ParseGroupID(id) return err }), @@ -66,11 +66,11 @@ func resourceApiManagementGroup() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ForceNew: true, - Default: string(apimanagement.GroupTypeCustom), + Default: string(group.GroupTypeCustom), ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.GroupTypeCustom), - string(apimanagement.GroupTypeExternal), - string(apimanagement.GroupTypeSystem), + string(group.GroupTypeCustom), + string(group.GroupTypeExternal), + string(group.GroupTypeSystem), }, false), }, }, @@ -83,7 +83,7 @@ func resourceApiManagementGroupCreateUpdate(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) + id := group.NewGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) displayName := d.Get("display_name").(string) description := d.Get("description").(string) @@ -91,28 +91,28 @@ func resourceApiManagementGroupCreateUpdate(d *pluginsdk.ResourceData, meta inte groupType := d.Get("type").(string) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_group", id.ID()) } } - parameters := apimanagement.GroupCreateParameters{ - GroupCreateParametersProperties: &apimanagement.GroupCreateParametersProperties{ - DisplayName: utils.String(displayName), - Description: utils.String(description), - ExternalID: utils.String(externalID), - Type: apimanagement.GroupType(groupType), + parameters := group.GroupCreateParameters{ + Properties: &group.GroupCreateParametersProperties{ + DisplayName: displayName, + Description: pointer.To(description), + ExternalId: pointer.To(externalID), + Type: pointer.To(group.GroupType(groupType)), }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.Name, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, group.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating or updating %s: %+v", id, err) } @@ -126,31 +126,32 @@ func resourceApiManagementGroupRead(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.GroupID(d.Id()) + id, err := group.ParseGroupID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - - return fmt.Errorf("making Read request for %s: %+v", *id, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) - if properties := resp.GroupContractProperties; properties != nil { - d.Set("display_name", properties.DisplayName) - d.Set("description", properties.Description) - d.Set("external_id", properties.ExternalID) - d.Set("type", string(properties.Type)) + if model := resp.Model; model != nil { + d.Set("name", pointer.From(model.Name)) + if properties := model.Properties; properties != nil { + d.Set("display_name", properties.DisplayName) + d.Set("description", properties.Description) + d.Set("external_id", properties.ExternalId) + d.Set("type", string(pointer.From(properties.Type))) + } } return nil @@ -161,13 +162,13 @@ func resourceApiManagementGroupDelete(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.GroupID(d.Id()) + id, err := group.ParseGroupID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.Name, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id, group.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_group_resource_test.go b/internal/services/apimanagement/api_management_group_resource_test.go index 8017f415f693..ee31083dd50c 100644 --- a/internal/services/apimanagement/api_management_group_resource_test.go +++ b/internal/services/apimanagement/api_management_group_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementGroupResource struct{} @@ -106,17 +106,17 @@ func TestAccApiManagementGroup_descriptionDisplayNameUpdate(t *testing.T) { } func (ApiManagementGroupResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.GroupID(state.ID) + id, err := group.ParseGroupID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.GroupClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := clients.ApiManagement.GroupClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementGroupResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_group_user_resource.go b/internal/services/apimanagement/api_management_group_user_resource.go index f74506fd246e..3ba3f207c39b 100644 --- a/internal/services/apimanagement/api_management_group_user_resource.go +++ b/internal/services/apimanagement/api_management_group_user_resource.go @@ -8,14 +8,14 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementGroupUser() *pluginsdk.Resource { @@ -24,7 +24,7 @@ func resourceApiManagementGroupUser() *pluginsdk.Resource { Read: resourceApiManagementGroupUserRead, Delete: resourceApiManagementGroupUserDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.GroupUserID(id) + _, err := groupuser.ParseGroupUserID(id) return err }), @@ -53,21 +53,21 @@ func resourceApiManagementGroupUserCreate(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewGroupUserID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("group_name").(string), d.Get("user_id").(string)) + id := groupuser.NewGroupUserID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("group_name").(string), d.Get("user_id").(string)) - exists, err := client.CheckEntityExists(ctx, id.ResourceGroup, id.ServiceName, id.GroupName, id.UserName) + exists, err := client.CheckEntityExists(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(exists) { + if !response.WasNotFound(exists.HttpResponse) { return fmt.Errorf("checking for present of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(exists) { + if !response.WasNotFound(exists.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_group_user", id.ID()) } - if _, err := client.Create(ctx, id.ResourceGroup, id.ServiceName, id.GroupName, id.UserName); err != nil { - return fmt.Errorf("adding User %q to Group %q (API Management Service %q / Resource Group %q): %+v", id.UserName, id.GroupName, id.ServiceName, id.ResourceGroup, err) + if _, err := client.Create(ctx, id); err != nil { + return fmt.Errorf("creating or updating %s: %+v", id, err) } d.SetId(id.ID()) @@ -80,14 +80,14 @@ func resourceApiManagementGroupUserRead(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.GroupUserID(d.Id()) + id, err := groupuser.ParseGroupUserID(d.Id()) if err != nil { return err } - resp, err := client.CheckEntityExists(ctx, id.ResourceGroup, id.ServiceName, id.GroupName, id.UserName) + resp, err := client.CheckEntityExists(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -96,9 +96,9 @@ func resourceApiManagementGroupUserRead(d *pluginsdk.ResourceData, meta interfac return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("group_name", id.GroupName) - d.Set("user_id", id.UserName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("group_name", id.GroupId) + d.Set("user_id", id.UserId) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) return nil @@ -109,14 +109,14 @@ func resourceApiManagementGroupUserDelete(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.GroupUserID(d.Id()) + id, err := groupuser.ParseGroupUserID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.GroupName, id.UserName); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("removing User %q from Group %q (API Management Service %q / Resource Group %q): %+v", id.UserName, id.GroupName, id.ServiceName, id.ResourceGroup, err) + if resp, err := client.Delete(ctx, *id); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_group_user_resource_test.go b/internal/services/apimanagement/api_management_group_user_resource_test.go index 9edb59cdcecc..ea56c2aeb85a 100644 --- a/internal/services/apimanagement/api_management_group_user_resource_test.go +++ b/internal/services/apimanagement/api_management_group_user_resource_test.go @@ -8,12 +8,13 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementGroupUserResource struct{} @@ -49,21 +50,21 @@ func TestAccAzureRMApiManagementGroupUser_requiresImport(t *testing.T) { } func (ApiManagementGroupUserResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.GroupUserID(state.ID) + id, err := groupuser.ParseGroupUserID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.GroupUsersClient.CheckEntityExists(ctx, id.ResourceGroup, id.ServiceName, id.GroupName, id.UserName) + resp, err := clients.ApiManagement.GroupUsersClient.CheckEntityExists(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } // the HEAD API not found returns resp 404, but no err - if utils.ResponseWasNotFound(resp) { - return utils.Bool(false), nil + if response.WasNotFound(resp.HttpResponse) { + return pointer.To(false), nil } - return utils.Bool(true), nil + return pointer.To(true), nil } func (ApiManagementGroupUserResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_identity_provider_aad_resource.go b/internal/services/apimanagement/api_management_identity_provider_aad_resource.go index be364e726aab..ca46dd56c94f 100644 --- a/internal/services/apimanagement/api_management_identity_provider_aad_resource.go +++ b/internal/services/apimanagement/api_management_identity_provider_aad_resource.go @@ -8,11 +8,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -27,7 +28,7 @@ func resourceApiManagementIdentityProviderAAD() *pluginsdk.Resource { Update: resourceApiManagementIdentityProviderAADCreateUpdate, Delete: resourceApiManagementIdentityProviderAADDelete, - Importer: identityProviderImportFunc(apimanagement.IdentityProviderTypeAad), + Importer: identityProviderImportFunc(identityprovider.IdentityProviderTypeAad), Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), @@ -81,32 +82,32 @@ func resourceApiManagementIdentityProviderAADCreateUpdate(d *pluginsdk.ResourceD clientSecret := d.Get("client_secret").(string) allowedTenants := d.Get("allowed_tenants").([]interface{}) signinTenant := d.Get("signin_tenant").(string) - id := parse.NewIdentityProviderID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), string(apimanagement.IdentityProviderTypeAad)) + id := identityprovider.NewIdentityProviderID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), identityprovider.IdentityProviderTypeAad) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderTypeAad) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_identity_provider_aad", id.ID()) } } - parameters := apimanagement.IdentityProviderCreateContract{ - IdentityProviderCreateContractProperties: &apimanagement.IdentityProviderCreateContractProperties{ - ClientID: utils.String(clientID), - ClientSecret: utils.String(clientSecret), - Type: apimanagement.IdentityProviderTypeAad, + parameters := identityprovider.IdentityProviderCreateContract{ + Properties: &identityprovider.IdentityProviderCreateContractProperties{ + ClientId: clientID, + ClientSecret: clientSecret, + Type: pointer.To(identityprovider.IdentityProviderTypeAad), AllowedTenants: utils.ExpandStringSlice(allowedTenants), - SigninTenant: utils.String(signinTenant), + SigninTenant: pointer.To(signinTenant), }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderTypeAad, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, identityprovider.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -120,32 +121,31 @@ func resourceApiManagementIdentityProviderAADRead(d *pluginsdk.ResourceData, met ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IdentityProviderID(d.Id()) + id, err := identityprovider.ParseIdentityProviderID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup + resourceGroup := id.ResourceGroupName serviceName := id.ServiceName - identityProviderName := id.Name - resp, err := client.Get(ctx, resourceGroup, serviceName, apimanagement.IdentityProviderType(identityProviderName)) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Identity Provider %q (Resource Group %q / API Management Service %q) was not found - removing from state!", identityProviderName, resourceGroup, serviceName) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("making Read request for Identity Provider %q (Resource Group %q / API Management Service %q): %+v", identityProviderName, resourceGroup, serviceName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("resource_group_name", resourceGroup) d.Set("api_management_name", serviceName) - if props := resp.IdentityProviderContractProperties; props != nil { - d.Set("client_id", props.ClientID) - d.Set("allowed_tenants", props.AllowedTenants) - d.Set("signin_tenant", props.SigninTenant) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("client_id", model.Properties.ClientId) + d.Set("allowed_tenants", pointer.From(model.Properties.AllowedTenants)) + d.Set("signin_tenant", pointer.From(model.Properties.SigninTenant)) } return nil @@ -156,17 +156,14 @@ func resourceApiManagementIdentityProviderAADDelete(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IdentityProviderID(d.Id()) + id, err := identityprovider.ParseIdentityProviderID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - identityProviderName := id.Name - if resp, err := client.Delete(ctx, resourceGroup, serviceName, apimanagement.IdentityProviderType(identityProviderName), ""); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting Identity Provider %q (Resource Group %q / API Management Service %q): %+v", identityProviderName, resourceGroup, serviceName, err) + if resp, err := client.Delete(ctx, *id, identityprovider.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_identity_provider_aad_resource_test.go b/internal/services/apimanagement/api_management_identity_provider_aad_resource_test.go index 470a109fc60d..72cad2823477 100644 --- a/internal/services/apimanagement/api_management_identity_provider_aad_resource_test.go +++ b/internal/services/apimanagement/api_management_identity_provider_aad_resource_test.go @@ -8,13 +8,12 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementIdentityProviderAADResource struct{} @@ -80,17 +79,17 @@ func TestAccApiManagementIdentityProviderAAD_requiresImport(t *testing.T) { } func (ApiManagementIdentityProviderAADResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.IdentityProviderID(state.ID) + id, err := identityprovider.ParseIdentityProviderID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.IdentityProviderClient.Get(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderType(id.Name)) + resp, err := clients.ApiManagement.IdentityProviderClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading ApiManagement Identity Provider AAD (%s): %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementIdentityProviderAADResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_identity_provider_aadb2c_resource.go b/internal/services/apimanagement/api_management_identity_provider_aadb2c_resource.go index eb5366708869..4516ffd3d827 100644 --- a/internal/services/apimanagement/api_management_identity_provider_aadb2c_resource.go +++ b/internal/services/apimanagement/api_management_identity_provider_aadb2c_resource.go @@ -8,11 +8,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -27,7 +28,7 @@ func resourceArmApiManagementIdentityProviderAADB2C() *pluginsdk.Resource { Update: resourceArmApiManagementIdentityProviderAADB2CCreateUpdate, Delete: resourceArmApiManagementIdentityProviderAADB2CDelete, - Importer: identityProviderImportFunc(apimanagement.IdentityProviderTypeAadB2C), + Importer: identityProviderImportFunc(identityprovider.IdentityProviderTypeAadBTwoC), Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), @@ -122,12 +123,12 @@ func resourceArmApiManagementIdentityProviderAADB2CCreateUpdate(d *pluginsdk.Res profileEditingPolicy := d.Get("profile_editing_policy").(string) passwordResetPolicy := d.Get("password_reset_policy").(string) - id := parse.NewIdentityProviderID(client.SubscriptionID, resourceGroup, serviceName, string(apimanagement.IdentityProviderTypeAadB2C)) + id := identityprovider.NewIdentityProviderID(meta.(*clients.Client).Account.SubscriptionId, resourceGroup, serviceName, identityprovider.IdentityProviderTypeAadBTwoC) if d.IsNewResource() { - existing, err := client.Get(ctx, resourceGroup, serviceName, apimanagement.IdentityProviderTypeAadB2C) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id.String(), err) } } else { @@ -135,23 +136,23 @@ func resourceArmApiManagementIdentityProviderAADB2CCreateUpdate(d *pluginsdk.Res } } - parameters := apimanagement.IdentityProviderCreateContract{ - IdentityProviderCreateContractProperties: &apimanagement.IdentityProviderCreateContractProperties{ - ClientID: utils.String(clientID), - ClientSecret: utils.String(clientSecret), - Type: apimanagement.IdentityProviderTypeAadB2C, + parameters := identityprovider.IdentityProviderCreateContract{ + Properties: &identityprovider.IdentityProviderCreateContractProperties{ + ClientId: clientID, + ClientSecret: clientSecret, + Type: pointer.To(identityprovider.IdentityProviderTypeAadBTwoC), AllowedTenants: utils.ExpandStringSlice([]interface{}{allowedTenant}), - SigninTenant: utils.String(signinTenant), - Authority: utils.String(authority), - SignupPolicyName: utils.String(signupPolicy), - SigninPolicyName: utils.String(signinPolicy), - ProfileEditingPolicyName: utils.String(profileEditingPolicy), - PasswordResetPolicyName: utils.String(passwordResetPolicy), + SigninTenant: pointer.To(signinTenant), + Authority: pointer.To(authority), + SignupPolicyName: pointer.To(signupPolicy), + SigninPolicyName: pointer.To(signinPolicy), + ProfileEditingPolicyName: pointer.To(profileEditingPolicy), + PasswordResetPolicyName: pointer.To(passwordResetPolicy), }, } - if _, err := client.CreateOrUpdate(ctx, resourceGroup, serviceName, apimanagement.IdentityProviderTypeAadB2C, parameters, ""); err != nil { - return fmt.Errorf("creating or updating Identity Provider %q (Resource Group %q / API Management Service %q): %+v", apimanagement.IdentityProviderTypeAadB2C, resourceGroup, serviceName, err) + if _, err := client.CreateOrUpdate(ctx, id, parameters, identityprovider.CreateOrUpdateOperationOptions{}); err != nil { + return fmt.Errorf("creating or updating %s: %+v", id, err) } d.SetId(id.ID()) @@ -163,36 +164,36 @@ func resourceArmApiManagementIdentityProviderAADB2CRead(d *pluginsdk.ResourceDat ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IdentityProviderID(d.Id()) + id, err := identityprovider.ParseIdentityProviderID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderType(id.Name)) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Identity Provider %q (Resource Group %q / API Management Service %q) was not found - removing from state!", id.Name, id.ResourceGroup, id.ServiceName) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("making Read request for Identity Provider %q (Resource Group %q / API Management Service %q): %+v", id.Name, id.ResourceGroup, id.ServiceName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) - if props := resp.IdentityProviderContractProperties; props != nil { - d.Set("client_id", props.ClientID) - d.Set("signin_tenant", props.SigninTenant) - d.Set("authority", props.Authority) - d.Set("signup_policy", props.SignupPolicyName) - d.Set("signin_policy", props.SigninPolicyName) - d.Set("profile_editing_policy", props.ProfileEditingPolicyName) - d.Set("password_reset_policy", props.PasswordResetPolicyName) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("client_id", model.Properties.ClientId) + d.Set("signin_tenant", model.Properties.SigninTenant) + d.Set("authority", model.Properties.Authority) + d.Set("signup_policy", model.Properties.SignupPolicyName) + d.Set("signin_policy", model.Properties.SigninPolicyName) + d.Set("profile_editing_policy", model.Properties.ProfileEditingPolicyName) + d.Set("password_reset_policy", model.Properties.PasswordResetPolicyName) allowedTenant := "" - if allowedTenants := props.AllowedTenants; allowedTenants != nil && len(*allowedTenants) > 0 { + if allowedTenants := model.Properties.AllowedTenants; allowedTenants != nil && len(*allowedTenants) > 0 { t := *allowedTenants allowedTenant = t[0] } @@ -207,14 +208,14 @@ func resourceArmApiManagementIdentityProviderAADB2CDelete(d *pluginsdk.ResourceD ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IdentityProviderID(d.Id()) + id, err := identityprovider.ParseIdentityProviderID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderType(id.Name), ""); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting Identity Provider %q (Resource Group %q / API Management Service %q): %+v", id.Name, id.ResourceGroup, id.ServiceName, err) + if resp, err := client.Delete(ctx, *id, identityprovider.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_identity_provider_aadb2c_resource_test.go b/internal/services/apimanagement/api_management_identity_provider_aadb2c_resource_test.go index 687992cc3eab..2835b2665bec 100644 --- a/internal/services/apimanagement/api_management_identity_provider_aadb2c_resource_test.go +++ b/internal/services/apimanagement/api_management_identity_provider_aadb2c_resource_test.go @@ -10,13 +10,13 @@ import ( "strings" "testing" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) /* @@ -91,17 +91,17 @@ func testAccAzureRMApiManagementIdentityProviderAADB2C_getB2CConfig(t *testing.T } func (ApiManagementIdentityProviderAADB2CResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.IdentityProviderID(state.ID) + id, err := identityprovider.ParseIdentityProviderID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.IdentityProviderClient.Get(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderType(id.Name)) + resp, err := clients.ApiManagement.IdentityProviderClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading ApiManagement Identity Provider AADB2C (%s): %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementIdentityProviderAADB2CResource) basic(data acceptance.TestData, b2cConfig map[string]string) string { diff --git a/internal/services/apimanagement/api_management_identity_provider_facebook_resource.go b/internal/services/apimanagement/api_management_identity_provider_facebook_resource.go index 5f0c6aa6cc49..249409419b5a 100644 --- a/internal/services/apimanagement/api_management_identity_provider_facebook_resource.go +++ b/internal/services/apimanagement/api_management_identity_provider_facebook_resource.go @@ -8,16 +8,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementIdentityProviderFacebook() *pluginsdk.Resource { @@ -27,7 +27,7 @@ func resourceApiManagementIdentityProviderFacebook() *pluginsdk.Resource { Update: resourceApiManagementIdentityProviderFacebookCreateUpdate, Delete: resourceApiManagementIdentityProviderFacebookDelete, - Importer: identityProviderImportFunc(apimanagement.IdentityProviderTypeFacebook), + Importer: identityProviderImportFunc(identityprovider.IdentityProviderTypeFacebook), Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), @@ -63,32 +63,32 @@ func resourceApiManagementIdentityProviderFacebookCreateUpdate(d *pluginsdk.Reso ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewIdentityProviderID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), string(apimanagement.IdentityProviderTypeFacebook)) + id := identityprovider.NewIdentityProviderID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), identityprovider.IdentityProviderTypeFacebook) clientID := d.Get("app_id").(string) clientSecret := d.Get("app_secret").(string) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderType(id.Name)) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_identity_provider_facebook", id.ID()) } } - parameters := apimanagement.IdentityProviderCreateContract{ - IdentityProviderCreateContractProperties: &apimanagement.IdentityProviderCreateContractProperties{ - ClientID: utils.String(clientID), - ClientSecret: utils.String(clientSecret), - Type: apimanagement.IdentityProviderTypeFacebook, + parameters := identityprovider.IdentityProviderCreateContract{ + Properties: &identityprovider.IdentityProviderCreateContractProperties{ + ClientId: clientID, + ClientSecret: clientSecret, + Type: pointer.To(identityprovider.IdentityProviderTypeFacebook), }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderTypeFacebook, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, identityprovider.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -102,30 +102,29 @@ func resourceApiManagementIdentityProviderFacebookRead(d *pluginsdk.ResourceData ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IdentityProviderID(d.Id()) + id, err := identityprovider.ParseIdentityProviderID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup + resourceGroup := id.ResourceGroupName serviceName := id.ServiceName - identityProviderName := id.Name - resp, err := client.Get(ctx, resourceGroup, serviceName, apimanagement.IdentityProviderType(identityProviderName)) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Identity Provider %q (Resource Group %q / API Management Service %q) was not found - removing from state!", identityProviderName, resourceGroup, serviceName) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("making Read request for Identity Provider %q (Resource Group %q / API Management Service %q): %+v", identityProviderName, resourceGroup, serviceName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("resource_group_name", resourceGroup) d.Set("api_management_name", serviceName) - if props := resp.IdentityProviderContractProperties; props != nil { - d.Set("app_id", props.ClientID) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("app_id", model.Properties.ClientId) } return nil @@ -136,17 +135,14 @@ func resourceApiManagementIdentityProviderFacebookDelete(d *pluginsdk.ResourceDa ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IdentityProviderID(d.Id()) + id, err := identityprovider.ParseIdentityProviderID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - identityProviderName := id.Name - if resp, err := client.Delete(ctx, resourceGroup, serviceName, apimanagement.IdentityProviderType(identityProviderName), ""); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting Identity Provider %q (Resource Group %q / API Management Service %q): %+v", identityProviderName, resourceGroup, serviceName, err) + if resp, err := client.Delete(ctx, *id, identityprovider.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_identity_provider_facebook_resource_test.go b/internal/services/apimanagement/api_management_identity_provider_facebook_resource_test.go index 2774eaff5b60..953966caa646 100644 --- a/internal/services/apimanagement/api_management_identity_provider_facebook_resource_test.go +++ b/internal/services/apimanagement/api_management_identity_provider_facebook_resource_test.go @@ -8,13 +8,12 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementIdentityProviderFacebookResource struct{} @@ -74,17 +73,17 @@ func TestAccApiManagementIdentityProviderFacebook_requiresImport(t *testing.T) { } func (ApiManagementIdentityProviderFacebookResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.IdentityProviderID(state.ID) + id, err := identityprovider.ParseIdentityProviderID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.IdentityProviderClient.Get(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderType(id.Name)) + resp, err := clients.ApiManagement.IdentityProviderClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading ApiManagement Identity Provider Facebook (%s): %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementIdentityProviderFacebookResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_identity_provider_google_resource.go b/internal/services/apimanagement/api_management_identity_provider_google_resource.go index 68849af68308..3aea0fa4ca1a 100644 --- a/internal/services/apimanagement/api_management_identity_provider_google_resource.go +++ b/internal/services/apimanagement/api_management_identity_provider_google_resource.go @@ -8,17 +8,17 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementIdentityProviderGoogle() *pluginsdk.Resource { @@ -28,7 +28,7 @@ func resourceApiManagementIdentityProviderGoogle() *pluginsdk.Resource { Update: resourceApiManagementIdentityProviderGoogleCreateUpdate, Delete: resourceApiManagementIdentityProviderGoogleDelete, - Importer: identityProviderImportFunc(apimanagement.IdentityProviderTypeGoogle), + Importer: identityProviderImportFunc(identityprovider.IdentityProviderTypeGoogle), Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), @@ -64,32 +64,32 @@ func resourceApiManagementIdentityProviderGoogleCreateUpdate(d *pluginsdk.Resour ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewIdentityProviderID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), string(apimanagement.IdentityProviderTypeGoogle)) + id := identityprovider.NewIdentityProviderID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), identityprovider.IdentityProviderTypeGoogle) clientID := d.Get("client_id").(string) clientSecret := d.Get("client_secret").(string) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderType(id.Name)) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_identity_provider_google", id.ID()) } } - parameters := apimanagement.IdentityProviderCreateContract{ - IdentityProviderCreateContractProperties: &apimanagement.IdentityProviderCreateContractProperties{ - ClientID: utils.String(clientID), - ClientSecret: utils.String(clientSecret), - Type: apimanagement.IdentityProviderTypeGoogle, + parameters := identityprovider.IdentityProviderCreateContract{ + Properties: &identityprovider.IdentityProviderCreateContractProperties{ + ClientId: clientID, + ClientSecret: clientSecret, + Type: pointer.To(identityprovider.IdentityProviderTypeGoogle), }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderTypeGoogle, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, identityprovider.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -103,30 +103,29 @@ func resourceApiManagementIdentityProviderGoogleRead(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IdentityProviderID(d.Id()) + id, err := identityprovider.ParseIdentityProviderID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup + resourceGroup := id.ResourceGroupName serviceName := id.ServiceName - identityProviderName := id.Name - resp, err := client.Get(ctx, resourceGroup, serviceName, apimanagement.IdentityProviderType(identityProviderName)) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Identity Provider %q (Resource Group %q / API Management Service %q) was not found - removing from state!", identityProviderName, resourceGroup, serviceName) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("making Read request for Identity Provider %q (Resource Group %q / API Management Service %q): %+v", identityProviderName, resourceGroup, serviceName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("resource_group_name", resourceGroup) d.Set("api_management_name", serviceName) - if props := resp.IdentityProviderContractProperties; props != nil { - d.Set("client_id", props.ClientID) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("client_id", model.Properties.ClientId) } return nil @@ -137,17 +136,14 @@ func resourceApiManagementIdentityProviderGoogleDelete(d *pluginsdk.ResourceData ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IdentityProviderID(d.Id()) + id, err := identityprovider.ParseIdentityProviderID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - identityProviderName := id.Name - if resp, err := client.Delete(ctx, resourceGroup, serviceName, apimanagement.IdentityProviderType(identityProviderName), ""); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting Identity Provider %q (Resource Group %q / API Management Service %q): %+v", identityProviderName, resourceGroup, serviceName, err) + if resp, err := client.Delete(ctx, *id, identityprovider.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_identity_provider_google_resource_test.go b/internal/services/apimanagement/api_management_identity_provider_google_resource_test.go index 64c4328056e0..11d8b8c15b5e 100644 --- a/internal/services/apimanagement/api_management_identity_provider_google_resource_test.go +++ b/internal/services/apimanagement/api_management_identity_provider_google_resource_test.go @@ -8,13 +8,12 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementIdentityProviderGoogleResource struct{} @@ -74,17 +73,17 @@ func TestAccApiManagementIdentityProviderGoogle_requiresImport(t *testing.T) { } func (ApiManagementIdentityProviderGoogleResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.IdentityProviderID(state.ID) + id, err := identityprovider.ParseIdentityProviderID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.IdentityProviderClient.Get(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderType(id.Name)) + resp, err := clients.ApiManagement.IdentityProviderClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading ApiManagement Identity Provider Google (%s): %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementIdentityProviderGoogleResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_identity_provider_microsoft_resource.go b/internal/services/apimanagement/api_management_identity_provider_microsoft_resource.go index b6daba3e6f94..c002a6196912 100644 --- a/internal/services/apimanagement/api_management_identity_provider_microsoft_resource.go +++ b/internal/services/apimanagement/api_management_identity_provider_microsoft_resource.go @@ -8,16 +8,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementIdentityProviderMicrosoft() *pluginsdk.Resource { @@ -27,7 +27,7 @@ func resourceApiManagementIdentityProviderMicrosoft() *pluginsdk.Resource { Update: resourceApiManagementIdentityProviderMicrosoftCreateUpdate, Delete: resourceApiManagementIdentityProviderMicrosoftDelete, - Importer: identityProviderImportFunc(apimanagement.IdentityProviderTypeMicrosoft), + Importer: identityProviderImportFunc(identityprovider.IdentityProviderTypeMicrosoft), Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), @@ -65,30 +65,30 @@ func resourceApiManagementIdentityProviderMicrosoftCreateUpdate(d *pluginsdk.Res clientID := d.Get("client_id").(string) clientSecret := d.Get("client_secret").(string) - id := parse.NewIdentityProviderID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), string(apimanagement.IdentityProviderTypeMicrosoft)) + id := identityprovider.NewIdentityProviderID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), identityprovider.IdentityProviderTypeMicrosoft) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderType(id.Name)) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_identity_provider_microsoft", id.ID()) } } - parameters := apimanagement.IdentityProviderCreateContract{ - IdentityProviderCreateContractProperties: &apimanagement.IdentityProviderCreateContractProperties{ - ClientID: utils.String(clientID), - ClientSecret: utils.String(clientSecret), - Type: apimanagement.IdentityProviderTypeMicrosoft, + parameters := identityprovider.IdentityProviderCreateContract{ + Properties: &identityprovider.IdentityProviderCreateContractProperties{ + ClientId: clientID, + ClientSecret: clientSecret, + Type: pointer.To(identityprovider.IdentityProviderTypeMicrosoft), }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderTypeMicrosoft, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, identityprovider.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -102,30 +102,29 @@ func resourceApiManagementIdentityProviderMicrosoftRead(d *pluginsdk.ResourceDat ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IdentityProviderID(d.Id()) + id, err := identityprovider.ParseIdentityProviderID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup + resourceGroup := id.ResourceGroupName serviceName := id.ServiceName - identityProviderName := id.Name - resp, err := client.Get(ctx, resourceGroup, serviceName, apimanagement.IdentityProviderType(identityProviderName)) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Identity Provider %q (Resource Group %q / API Management Service %q) was not found - removing from state!", identityProviderName, resourceGroup, serviceName) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("making Read request for Identity Provider %q (Resource Group %q / API Management Service %q): %+v", identityProviderName, resourceGroup, serviceName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("resource_group_name", resourceGroup) d.Set("api_management_name", serviceName) - if props := resp.IdentityProviderContractProperties; props != nil { - d.Set("client_id", props.ClientID) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("client_id", model.Properties.ClientId) } return nil @@ -136,17 +135,14 @@ func resourceApiManagementIdentityProviderMicrosoftDelete(d *pluginsdk.ResourceD ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IdentityProviderID(d.Id()) + id, err := identityprovider.ParseIdentityProviderID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - identityProviderName := id.Name - if resp, err := client.Delete(ctx, resourceGroup, serviceName, apimanagement.IdentityProviderType(identityProviderName), ""); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting Identity Provider %q (Resource Group %q / API Management Service %q): %+v", identityProviderName, resourceGroup, serviceName, err) + if resp, err := client.Delete(ctx, *id, identityprovider.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_identity_provider_microsoft_resource_test.go b/internal/services/apimanagement/api_management_identity_provider_microsoft_resource_test.go index 3080bf77d1fd..6fb898e8c6c8 100644 --- a/internal/services/apimanagement/api_management_identity_provider_microsoft_resource_test.go +++ b/internal/services/apimanagement/api_management_identity_provider_microsoft_resource_test.go @@ -8,13 +8,12 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementIdentityProviderMicrosoftResource struct{} @@ -74,17 +73,17 @@ func TestAccApiManagementIdentityProviderMicrosoft_requiresImport(t *testing.T) } func (ApiManagementIdentityProviderMicrosoftResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.IdentityProviderID(state.ID) + id, err := identityprovider.ParseIdentityProviderID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.IdentityProviderClient.Get(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderType(id.Name)) + resp, err := clients.ApiManagement.IdentityProviderClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading ApiManagement Identity Provider Microsoft (%s): %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementIdentityProviderMicrosoftResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_identity_provider_twitter_resource.go b/internal/services/apimanagement/api_management_identity_provider_twitter_resource.go index df290276c32d..e1b6db550615 100644 --- a/internal/services/apimanagement/api_management_identity_provider_twitter_resource.go +++ b/internal/services/apimanagement/api_management_identity_provider_twitter_resource.go @@ -8,16 +8,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementIdentityProviderTwitter() *pluginsdk.Resource { @@ -27,7 +27,7 @@ func resourceApiManagementIdentityProviderTwitter() *pluginsdk.Resource { Update: resourceApiManagementIdentityProviderTwitterCreateUpdate, Delete: resourceApiManagementIdentityProviderTwitterDelete, - Importer: identityProviderImportFunc(apimanagement.IdentityProviderTypeTwitter), + Importer: identityProviderImportFunc(identityprovider.IdentityProviderTypeTwitter), Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), @@ -66,30 +66,30 @@ func resourceApiManagementIdentityProviderTwitterCreateUpdate(d *pluginsdk.Resou clientID := d.Get("api_key").(string) clientSecret := d.Get("api_secret_key").(string) - id := parse.NewIdentityProviderID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), string(apimanagement.IdentityProviderTypeTwitter)) + id := identityprovider.NewIdentityProviderID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), identityprovider.IdentityProviderTypeTwitter) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderTypeTwitter) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_api_management_identity_provider_twitter", *existing.ID) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_api_management_identity_provider_twitter", id.ID()) } } - parameters := apimanagement.IdentityProviderCreateContract{ - IdentityProviderCreateContractProperties: &apimanagement.IdentityProviderCreateContractProperties{ - ClientID: utils.String(clientID), - ClientSecret: utils.String(clientSecret), - Type: apimanagement.IdentityProviderTypeTwitter, + parameters := identityprovider.IdentityProviderCreateContract{ + Properties: &identityprovider.IdentityProviderCreateContractProperties{ + ClientId: clientID, + ClientSecret: clientSecret, + Type: pointer.To(identityprovider.IdentityProviderTypeTwitter), }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderTypeTwitter, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, identityprovider.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -103,30 +103,29 @@ func resourceApiManagementIdentityProviderTwitterRead(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IdentityProviderID(d.Id()) + id, err := identityprovider.ParseIdentityProviderID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup + resourceGroup := id.ResourceGroupName serviceName := id.ServiceName - identityProviderName := id.Name - resp, err := client.Get(ctx, resourceGroup, serviceName, apimanagement.IdentityProviderType(identityProviderName)) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Identity Provider %q (Resource Group %q / API Management Service %q) was not found - removing from state!", identityProviderName, resourceGroup, serviceName) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("making Read request for Identity Provider %q (Resource Group %q / API Management Service %q): %+v", identityProviderName, resourceGroup, serviceName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("resource_group_name", resourceGroup) d.Set("api_management_name", serviceName) - if props := resp.IdentityProviderContractProperties; props != nil { - d.Set("api_key", props.ClientID) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("api_key", model.Properties.ClientId) } return nil @@ -137,17 +136,14 @@ func resourceApiManagementIdentityProviderTwitterDelete(d *pluginsdk.ResourceDat ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IdentityProviderID(d.Id()) + id, err := identityprovider.ParseIdentityProviderID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - identityProviderName := id.Name - if resp, err := client.Delete(ctx, resourceGroup, serviceName, apimanagement.IdentityProviderType(identityProviderName), ""); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting Identity Provider %q (Resource Group %q / API Management Service %q): %+v", identityProviderName, resourceGroup, serviceName, err) + if resp, err := client.Delete(ctx, *id, identityprovider.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_identity_provider_twitter_resource_test.go b/internal/services/apimanagement/api_management_identity_provider_twitter_resource_test.go index 2dd3ac0bdb63..12aba5f57f06 100644 --- a/internal/services/apimanagement/api_management_identity_provider_twitter_resource_test.go +++ b/internal/services/apimanagement/api_management_identity_provider_twitter_resource_test.go @@ -8,13 +8,12 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementIdentityProviderTwitterResource struct{} @@ -74,17 +73,17 @@ func TestAccApiManagementIdentityProviderTwitter_requiresImport(t *testing.T) { } func (ApiManagementIdentityProviderTwitterResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.IdentityProviderID(state.ID) + id, err := identityprovider.ParseIdentityProviderID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.IdentityProviderClient.Get(ctx, id.ResourceGroup, id.ServiceName, apimanagement.IdentityProviderType(id.Name)) + resp, err := clients.ApiManagement.IdentityProviderClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading ApiManagement Identity Provider Twitter (%s): %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementIdentityProviderTwitterResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_logger_resource.go b/internal/services/apimanagement/api_management_logger_resource.go index 82c4a71b7a15..d13130533ecb 100644 --- a/internal/services/apimanagement/api_management_logger_resource.go +++ b/internal/services/apimanagement/api_management_logger_resource.go @@ -8,18 +8,18 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementLogger() *pluginsdk.Resource { @@ -29,7 +29,7 @@ func resourceApiManagementLogger() *pluginsdk.Resource { Update: resourceApiManagementLoggerUpdate, Delete: resourceApiManagementLoggerDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.LoggerID(id) + _, err := logger.ParseLoggerID(id) return err }), @@ -116,7 +116,7 @@ func resourceApiManagementLoggerCreate(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewLoggerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) + id := logger.NewLoggerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) eventHubRaw := d.Get("eventhub").([]interface{}) appInsightsRaw := d.Get("application_insights").([]interface{}) @@ -126,38 +126,38 @@ func resourceApiManagementLoggerCreate(d *pluginsdk.ResourceData, meta interface } if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_logger", id.ID()) } } - parameters := apimanagement.LoggerContract{ - LoggerContractProperties: &apimanagement.LoggerContractProperties{ - IsBuffered: utils.Bool(d.Get("buffered").(bool)), - Description: utils.String(d.Get("description").(string)), + parameters := logger.LoggerContract{ + Properties: &logger.LoggerContractProperties{ + IsBuffered: pointer.To(d.Get("buffered").(bool)), + Description: pointer.To(d.Get("description").(string)), }, } if len(eventHubRaw) > 0 { - parameters.LoggerType = apimanagement.LoggerTypeAzureEventHub - parameters.Credentials = expandApiManagementLoggerEventHub(eventHubRaw) + parameters.Properties.LoggerType = logger.LoggerTypeAzureEventHub + parameters.Properties.Credentials = expandApiManagementLoggerEventHub(eventHubRaw) } else if len(appInsightsRaw) > 0 { - parameters.LoggerType = apimanagement.LoggerTypeApplicationInsights - parameters.Credentials = expandApiManagementLoggerApplicationInsights(appInsightsRaw) + parameters.Properties.LoggerType = logger.LoggerTypeApplicationInsights + parameters.Properties.Credentials = expandApiManagementLoggerApplicationInsights(appInsightsRaw) } if resourceId := d.Get("resource_id").(string); resourceId != "" { - parameters.ResourceID = utils.String(resourceId) + parameters.Properties.ResourceId = pointer.To(resourceId) } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.Name, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, logger.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -171,31 +171,33 @@ func resourceApiManagementLoggerRead(d *pluginsdk.ResourceData, meta interface{} ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.LoggerID(d.Id()) + id, err := logger.ParseLoggerID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s was not found - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("reading %s: %+v", *id, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) - d.Set("resource_id", resp.ResourceID) - if properties := resp.LoggerContractProperties; properties != nil { - d.Set("buffered", properties.IsBuffered) - d.Set("description", properties.Description) - if err := d.Set("eventhub", flattenApiManagementLoggerEventHub(d, properties)); err != nil { - return fmt.Errorf("setting `eventhub`: %s", err) + if model := resp.Model; model != nil { + d.Set("name", pointer.From(model.Name)) + if model.Properties != nil { + d.Set("resource_id", pointer.From(model.Properties.ResourceId)) + d.Set("buffered", pointer.From(model.Properties.IsBuffered)) + d.Set("description", pointer.From(model.Properties.Description)) + if err := d.Set("eventhub", flattenApiManagementLoggerEventHub(d, model.Properties)); err != nil { + return fmt.Errorf("setting `eventhub`: %s", err) + } } } @@ -208,27 +210,27 @@ func resourceApiManagementLoggerUpdate(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewLoggerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) + id := logger.NewLoggerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) eventHubRaw, hasEventHub := d.GetOk("eventhub") appInsightsRaw, hasAppInsights := d.GetOk("application_insights") - parameters := apimanagement.LoggerUpdateContract{ - LoggerUpdateParameters: &apimanagement.LoggerUpdateParameters{ - IsBuffered: utils.Bool(d.Get("buffered").(bool)), - Description: utils.String(d.Get("description").(string)), + parameters := logger.LoggerUpdateContract{ + Properties: &logger.LoggerUpdateParameters{ + IsBuffered: pointer.To(d.Get("buffered").(bool)), + Description: pointer.To(d.Get("description").(string)), }, } if hasEventHub { - parameters.LoggerType = apimanagement.LoggerTypeAzureEventHub - parameters.Credentials = expandApiManagementLoggerEventHub(eventHubRaw.([]interface{})) + parameters.Properties.LoggerType = pointer.To(logger.LoggerTypeAzureEventHub) + parameters.Properties.Credentials = expandApiManagementLoggerEventHub(eventHubRaw.([]interface{})) } else if hasAppInsights { - parameters.LoggerType = apimanagement.LoggerTypeApplicationInsights - parameters.Credentials = expandApiManagementLoggerApplicationInsights(appInsightsRaw.([]interface{})) + parameters.Properties.LoggerType = pointer.To(logger.LoggerTypeApplicationInsights) + parameters.Properties.Credentials = expandApiManagementLoggerApplicationInsights(appInsightsRaw.([]interface{})) } - if _, err := client.Update(ctx, id.ResourceGroup, id.ServiceName, id.Name, parameters, ""); err != nil { + if _, err := client.Update(ctx, id, parameters, logger.UpdateOperationOptions{}); err != nil { return fmt.Errorf("updating %s: %+v", id, err) } @@ -240,13 +242,13 @@ func resourceApiManagementLoggerDelete(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.LoggerID(d.Id()) + id, err := logger.ParseLoggerID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.Name, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id, logger.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", *id, err) } } @@ -254,26 +256,26 @@ func resourceApiManagementLoggerDelete(d *pluginsdk.ResourceData, meta interface return nil } -func expandApiManagementLoggerEventHub(input []interface{}) map[string]*string { - credentials := make(map[string]*string) +func expandApiManagementLoggerEventHub(input []interface{}) *map[string]string { + credentials := make(map[string]string) eventHub := input[0].(map[string]interface{}) - credentials["name"] = utils.String(eventHub["name"].(string)) - credentials["connectionString"] = utils.String(eventHub["connection_string"].(string)) - return credentials + credentials["name"] = eventHub["name"].(string) + credentials["connectionString"] = eventHub["connection_string"].(string) + return &credentials } -func expandApiManagementLoggerApplicationInsights(input []interface{}) map[string]*string { - credentials := make(map[string]*string) +func expandApiManagementLoggerApplicationInsights(input []interface{}) *map[string]string { + credentials := make(map[string]string) ai := input[0].(map[string]interface{}) - credentials["instrumentationKey"] = utils.String(ai["instrumentation_key"].(string)) - return credentials + credentials["instrumentationKey"] = ai["instrumentation_key"].(string) + return &credentials } -func flattenApiManagementLoggerEventHub(d *pluginsdk.ResourceData, properties *apimanagement.LoggerContractProperties) []interface{} { +func flattenApiManagementLoggerEventHub(d *pluginsdk.ResourceData, properties *logger.LoggerContractProperties) []interface{} { result := make([]interface{}, 0) - if name := properties.Credentials["name"]; name != nil { + if c := properties.Credentials; c != nil && (*c)["name"] != "" { eventHub := make(map[string]interface{}) - eventHub["name"] = *name + eventHub["name"] = (*c)["name"] if existing := d.Get("eventhub").([]interface{}); len(existing) > 0 { existingEventHub := existing[0].(map[string]interface{}) if conn, ok := existingEventHub["connection_string"]; ok { diff --git a/internal/services/apimanagement/api_management_logger_resource_test.go b/internal/services/apimanagement/api_management_logger_resource_test.go index 12055f9b73c6..4a117474aac7 100644 --- a/internal/services/apimanagement/api_management_logger_resource_test.go +++ b/internal/services/apimanagement/api_management_logger_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementLoggerResource struct{} @@ -186,17 +186,17 @@ func TestAccApiManagementLogger_update(t *testing.T) { } func (ApiManagementLoggerResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.LoggerID(state.ID) + id, err := logger.ParseLoggerID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.LoggerClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := clients.ApiManagement.LoggerClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementLoggerResource) basicEventHub(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_named_value_resource.go b/internal/services/apimanagement/api_management_named_value_resource.go index 2fdc0c2ae96e..09204f959c9e 100644 --- a/internal/services/apimanagement/api_management_named_value_resource.go +++ b/internal/services/apimanagement/api_management_named_value_resource.go @@ -8,11 +8,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -28,7 +29,7 @@ func resourceApiManagementNamedValue() *pluginsdk.Resource { Update: resourceApiManagementNamedValueCreateUpdate, Delete: resourceApiManagementNamedValueDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.NamedValueID(id) + _, err := namedvalue.ParseNamedValueID(id) return err }), @@ -104,44 +105,40 @@ func resourceApiManagementNamedValueCreateUpdate(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewNamedValueID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) + id := namedvalue.NewNamedValueID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf(" checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_property", id.ID()) } } - parameters := apimanagement.NamedValueCreateContract{ - NamedValueCreateContractProperties: &apimanagement.NamedValueCreateContractProperties{ - DisplayName: utils.String(d.Get("display_name").(string)), - Secret: utils.Bool(d.Get("secret").(bool)), + parameters := namedvalue.NamedValueCreateContract{ + Properties: &namedvalue.NamedValueCreateContractProperties{ + DisplayName: d.Get("display_name").(string), + Secret: pointer.To(d.Get("secret").(bool)), KeyVault: expandApiManagementNamedValueKeyVault(d.Get("value_from_key_vault").([]interface{})), }, } if v, ok := d.GetOk("value"); ok { - parameters.NamedValueCreateContractProperties.Value = utils.String(v.(string)) + parameters.Properties.Value = pointer.To(v.(string)) } if tags, ok := d.GetOk("tags"); ok { - parameters.NamedValueCreateContractProperties.Tags = utils.ExpandStringSlice(tags.([]interface{})) + parameters.Properties.Tags = utils.ExpandStringSlice(tags.([]interface{})) } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.Name, parameters, "") + err := client.CreateOrUpdateThenPoll(ctx, id, parameters, namedvalue.CreateOrUpdateOperationOptions{}) if err != nil { - return fmt.Errorf(" creating or updating %s: %+v", id, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting on creating/updating %s: %+v", id, err) + return fmt.Errorf("creating or updating %s: %+v", id, err) } d.SetId(id.ID()) @@ -154,37 +151,37 @@ func resourceApiManagementNamedValueRead(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NamedValueID(d.Id()) + id, err := namedvalue.ParseNamedValueID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf(" making Read request for %s: %+v", *id, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.NamedValueId) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) - if properties := resp.NamedValueContractProperties; properties != nil { - d.Set("display_name", properties.DisplayName) - d.Set("secret", properties.Secret) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("display_name", model.Properties.DisplayName) + d.Set("secret", pointer.From(model.Properties.Secret)) // API will not return `value` when `secret` is `true`, in which case we shall not set the `value`. Refer to the issue : #6688 - if properties.Secret != nil && !*properties.Secret { - d.Set("value", properties.Value) + if model.Properties.Secret != nil && !*model.Properties.Secret { + d.Set("value", pointer.From(model.Properties.Value)) } - if err := d.Set("value_from_key_vault", flattenApiManagementNamedValueKeyVault(properties.KeyVault)); err != nil { + if err := d.Set("value_from_key_vault", flattenApiManagementNamedValueKeyVault(model.Properties.KeyVault)); err != nil { return fmt.Errorf("setting `value_from_key_vault`: %+v", err) } - d.Set("tags", properties.Tags) + d.Set("tags", pointer.From(model.Properties.Tags)) } return nil @@ -195,13 +192,13 @@ func resourceApiManagementNamedValueDelete(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NamedValueID(d.Id()) + id, err := namedvalue.ParseNamedValueID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.Name, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id, namedvalue.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf(" deleting %s: %+v", *id, err) } } @@ -209,41 +206,32 @@ func resourceApiManagementNamedValueDelete(d *pluginsdk.ResourceData, meta inter return nil } -func expandApiManagementNamedValueKeyVault(inputs []interface{}) *apimanagement.KeyVaultContractCreateProperties { +func expandApiManagementNamedValueKeyVault(inputs []interface{}) *namedvalue.KeyVaultContractCreateProperties { if len(inputs) == 0 { return nil } input := inputs[0].(map[string]interface{}) - result := apimanagement.KeyVaultContractCreateProperties{ - SecretIdentifier: utils.String(input["secret_id"].(string)), + result := namedvalue.KeyVaultContractCreateProperties{ + SecretIdentifier: pointer.To(input["secret_id"].(string)), } if v := input["identity_client_id"].(string); v != "" { - result.IdentityClientID = utils.String(v) + result.IdentityClientId = pointer.To(v) } return &result } -func flattenApiManagementNamedValueKeyVault(input *apimanagement.KeyVaultContractProperties) []interface{} { +func flattenApiManagementNamedValueKeyVault(input *namedvalue.KeyVaultContractProperties) []interface{} { if input == nil { return []interface{}{} } - var secretId, clientId string - if input.SecretIdentifier != nil { - secretId = *input.SecretIdentifier - } - - if input.IdentityClientID != nil { - clientId = *input.IdentityClientID - } - return []interface{}{ map[string]interface{}{ - "secret_id": secretId, - "identity_client_id": clientId, + "secret_id": pointer.From(input.SecretIdentifier), + "identity_client_id": pointer.From(input.IdentityClientId), }, } } diff --git a/internal/services/apimanagement/api_management_named_value_resource_test.go b/internal/services/apimanagement/api_management_named_value_resource_test.go index 1bfe0f8566ea..24b8badc28d3 100644 --- a/internal/services/apimanagement/api_management_named_value_resource_test.go +++ b/internal/services/apimanagement/api_management_named_value_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementNamedValueResource struct{} @@ -115,17 +115,17 @@ func TestAccApiManagementNamedValue_update(t *testing.T) { } func (ApiManagementNamedValueResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.NamedValueID(state.ID) + id, err := namedvalue.ParseNamedValueID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.NamedValueClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := clients.ApiManagement.NamedValueClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementNamedValueResource) template(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_notification_recipient_email.go b/internal/services/apimanagement/api_management_notification_recipient_email.go index 8023d102b59f..0042862e4281 100644 --- a/internal/services/apimanagement/api_management_notification_recipient_email.go +++ b/internal/services/apimanagement/api_management_notification_recipient_email.go @@ -8,14 +8,14 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementNotificationRecipientEmailModel struct { @@ -34,7 +34,7 @@ func (r ApiManagementNotificationRecipientEmailResource) Arguments() map[string] Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ApiManagementID, + ValidateFunc: apimanagementservice.ValidateServiceID, }, "notification_type": { @@ -42,13 +42,13 @@ func (r ApiManagementNotificationRecipientEmailResource) Arguments() map[string] Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.NotificationNameAccountClosedPublisher), - string(apimanagement.NotificationNameBCC), - string(apimanagement.NotificationNameNewApplicationNotificationMessage), - string(apimanagement.NotificationNameNewIssuePublisherNotificationMessage), - string(apimanagement.NotificationNamePurchasePublisherNotificationMessage), - string(apimanagement.NotificationNameQuotaLimitApproachingPublisherNotificationMessage), - string(apimanagement.NotificationNameRequestPublisherNotificationMessage), + string(notificationrecipientemail.NotificationNameAccountClosedPublisher), + string(notificationrecipientemail.NotificationNameBCC), + string(notificationrecipientemail.NotificationNameNewApplicationNotificationMessage), + string(notificationrecipientemail.NotificationNameNewIssuePublisherNotificationMessage), + string(notificationrecipientemail.NotificationNamePurchasePublisherNotificationMessage), + string(notificationrecipientemail.NotificationNameQuotaLimitApproachingPublisherNotificationMessage), + string(notificationrecipientemail.NotificationNameRequestPublisherNotificationMessage), }, false), }, @@ -85,29 +85,30 @@ func (r ApiManagementNotificationRecipientEmailResource) Create() sdk.ResourceFu return fmt.Errorf("decoding %+v", err) } - apiManagementId, err := parse.ApiManagementID(model.ApiManagementId) + apiManagementId, err := apimanagementservice.ParseServiceID(model.ApiManagementId) if err != nil { return err } - id := parse.NewNotificationRecipientEmailID(subscriptionId, apiManagementId.ResourceGroup, apiManagementId.ServiceName, model.NotificationName, model.Email) + id := notificationrecipientemail.NewRecipientEmailID(subscriptionId, apiManagementId.ResourceGroupName, apiManagementId.ServiceName, notificationrecipientemail.NotificationName(model.NotificationName), model.Email) // CheckEntityExists can not be used, it returns autorest error - emails, err := client.ListByNotification(ctx, id.ResourceGroup, id.ServiceName, apimanagement.NotificationName(id.NotificationName)) + notificationId := notificationrecipientemail.NewNotificationID(subscriptionId, apiManagementId.ResourceGroupName, apiManagementId.ServiceName, notificationrecipientemail.NotificationName(model.NotificationName)) + emails, err := client.ListByNotification(ctx, notificationId) if err != nil { - if !utils.ResponseWasNotFound(emails.Response) { + if !response.WasNotFound(emails.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if emails.Value != nil { - for _, existing := range *emails.Value { - if existing.RecipientEmailContractProperties != nil && existing.RecipientEmailContractProperties.Email != nil && *existing.RecipientEmailContractProperties.Email == model.Email { + if m := emails.Model; m != nil && m.Value != nil { + for _, existing := range *m.Value { + if existing.Properties != nil && existing.Properties.Email != nil && *existing.Properties.Email == model.Email { return metadata.ResourceRequiresImport(r.ResourceType(), id) } } } - if _, err = client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, apimanagement.NotificationName(id.NotificationName), id.RecipientEmailName); err != nil { + if _, err = client.CreateOrUpdate(ctx, id); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -124,34 +125,36 @@ func (r ApiManagementNotificationRecipientEmailResource) Read() sdk.ResourceFunc Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.ApiManagement.NotificationRecipientEmailClient - id, err := parse.NotificationRecipientEmailID(metadata.ResourceData.Id()) + id, err := notificationrecipientemail.ParseRecipientEmailID(metadata.ResourceData.Id()) if err != nil { return err } // CheckEntityExists can not be used, it returns autorest error - emails, err := client.ListByNotification(ctx, id.ResourceGroup, id.ServiceName, apimanagement.NotificationName(id.NotificationName)) + notificationId := notificationrecipientemail.NewNotificationID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.NotificationName) + emails, err := client.ListByNotification(ctx, notificationId) if err != nil { - if !utils.ResponseWasNotFound(emails.Response) { - return fmt.Errorf("retrieving %s: %+v", id, err) + if !response.WasNotFound(emails.HttpResponse) { + return fmt.Errorf("retrieving %s: %+v", notificationId, err) } } found := false - if emails.Value != nil { - for _, existing := range *emails.Value { - if existing.RecipientEmailContractProperties != nil && existing.RecipientEmailContractProperties.Email != nil && *existing.RecipientEmailContractProperties.Email == id.RecipientEmailName { + if model := emails.Model; model != nil && model.Value != nil { + for _, existing := range *model.Value { + if existing.Properties != nil && existing.Properties.Email != nil && *existing.Properties.Email == id.RecipientEmailName { found = true } } } + if !found { return metadata.MarkAsGone(id) } model := ApiManagementNotificationRecipientEmailModel{ - ApiManagementId: parse.NewApiManagementID(id.SubscriptionId, id.ResourceGroup, id.ServiceName).ID(), - NotificationName: id.NotificationName, + ApiManagementId: apimanagementservice.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName).ID(), + NotificationName: string(id.NotificationName), Email: id.RecipientEmailName, } @@ -166,12 +169,12 @@ func (r ApiManagementNotificationRecipientEmailResource) Delete() sdk.ResourceFu Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.ApiManagement.NotificationRecipientEmailClient - id, err := parse.NotificationRecipientEmailID(metadata.ResourceData.Id()) + id, err := notificationrecipientemail.ParseRecipientEmailID(metadata.ResourceData.Id()) if err != nil { return err } - _, err = client.Delete(ctx, id.ResourceGroup, id.ServiceName, apimanagement.NotificationName(id.NotificationName), id.RecipientEmailName) + _, err = client.Delete(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } diff --git a/internal/services/apimanagement/api_management_notification_recipient_email_test.go b/internal/services/apimanagement/api_management_notification_recipient_email_test.go index 474348ca0905..3674d80467cf 100644 --- a/internal/services/apimanagement/api_management_notification_recipient_email_test.go +++ b/internal/services/apimanagement/api_management_notification_recipient_email_test.go @@ -8,13 +8,13 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementNotificationRecipientEmailResource struct{} @@ -50,25 +50,26 @@ func TestAccApiManagementNotificationRecipientEmail_requiresImport(t *testing.T) } func (ApiManagementNotificationRecipientEmailResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.NotificationRecipientEmailID(state.ID) + id, err := notificationrecipientemail.ParseRecipientEmailID(state.ID) if err != nil { return nil, err } - emails, err := client.ApiManagement.NotificationRecipientEmailClient.ListByNotification(ctx, id.ResourceGroup, id.ServiceName, apimanagement.NotificationName(id.NotificationName)) + notificationId := notificationrecipientemail.NewNotificationID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.NotificationName) + emails, err := client.ApiManagement.NotificationRecipientEmailClient.ListByNotification(ctx, notificationId) if err != nil { - if !utils.ResponseWasNotFound(emails.Response) { - return nil, fmt.Errorf("retrieving Api Management Notification Recipient Email %q (Resource Group %q): %+v", id.RecipientEmailName, id.ResourceGroup, err) + if !response.WasNotFound(emails.HttpResponse) { + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } } - if emails.Value != nil { - for _, existing := range *emails.Value { - if existing.RecipientEmailContractProperties != nil && existing.RecipientEmailContractProperties.Email != nil && *existing.RecipientEmailContractProperties.Email == id.RecipientEmailName { - return utils.Bool(true), nil + if model := emails.Model; model != nil && model.Value != nil { + for _, existing := range *model.Value { + if existing.Properties != nil && existing.Properties.Email != nil && *existing.Properties.Email == id.RecipientEmailName { + return pointer.To(true), nil } } } - return utils.Bool(false), nil + return pointer.To(false), nil } func (r ApiManagementNotificationRecipientEmailResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_notification_recipient_user.go b/internal/services/apimanagement/api_management_notification_recipient_user.go index 8262261ce70f..81e8a1fce6b4 100644 --- a/internal/services/apimanagement/api_management_notification_recipient_user.go +++ b/internal/services/apimanagement/api_management_notification_recipient_user.go @@ -8,14 +8,14 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementNotificationRecipientUserModel struct { @@ -34,7 +34,7 @@ func (r ApiManagementNotificationRecipientUserResource) Arguments() map[string]* Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ApiManagementID, + ValidateFunc: apimanagementservice.ValidateServiceID, }, "notification_type": { @@ -42,13 +42,13 @@ func (r ApiManagementNotificationRecipientUserResource) Arguments() map[string]* Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.NotificationNameAccountClosedPublisher), - string(apimanagement.NotificationNameBCC), - string(apimanagement.NotificationNameNewApplicationNotificationMessage), - string(apimanagement.NotificationNameNewIssuePublisherNotificationMessage), - string(apimanagement.NotificationNamePurchasePublisherNotificationMessage), - string(apimanagement.NotificationNameQuotaLimitApproachingPublisherNotificationMessage), - string(apimanagement.NotificationNameRequestPublisherNotificationMessage), + string(notificationrecipientuser.NotificationNameAccountClosedPublisher), + string(notificationrecipientuser.NotificationNameBCC), + string(notificationrecipientuser.NotificationNameNewApplicationNotificationMessage), + string(notificationrecipientuser.NotificationNameNewIssuePublisherNotificationMessage), + string(notificationrecipientuser.NotificationNamePurchasePublisherNotificationMessage), + string(notificationrecipientuser.NotificationNameQuotaLimitApproachingPublisherNotificationMessage), + string(notificationrecipientuser.NotificationNameRequestPublisherNotificationMessage), }, false), }, @@ -85,29 +85,30 @@ func (r ApiManagementNotificationRecipientUserResource) Create() sdk.ResourceFun return fmt.Errorf("decoding %+v", err) } - apiManagementId, err := parse.ApiManagementID(model.ApiManagementId) + apiManagementId, err := apimanagementservice.ParseServiceID(model.ApiManagementId) if err != nil { return err } - id := parse.NewNotificationRecipientUserID(subscriptionId, apiManagementId.ResourceGroup, apiManagementId.ServiceName, model.NotificationName, model.UserId) + id := notificationrecipientuser.NewRecipientUserID(subscriptionId, apiManagementId.ResourceGroupName, apiManagementId.ServiceName, notificationrecipientuser.NotificationName(model.NotificationName), model.UserId) // CheckEntityExists can not be used, it returns autorest error - users, err := client.ListByNotification(ctx, id.ResourceGroup, id.ServiceName, apimanagement.NotificationName(id.NotificationName)) + notificationId := notificationrecipientuser.NewNotificationID(subscriptionId, apiManagementId.ResourceGroupName, apiManagementId.ServiceName, notificationrecipientuser.NotificationName(model.NotificationName)) + users, err := client.ListByNotification(ctx, notificationId) if err != nil { - if !utils.ResponseWasNotFound(users.Response) { + if !response.WasNotFound(users.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if users.Value != nil { - for _, existing := range *users.Value { + if m := users.Model; m != nil && m.Value != nil { + for _, existing := range *m.Value { if existing.Name != nil && *existing.Name == model.UserId { return metadata.ResourceRequiresImport(r.ResourceType(), id) } } } - if _, err = client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, apimanagement.NotificationName(id.NotificationName), id.RecipientUserName); err != nil { + if _, err = client.CreateOrUpdate(ctx, id); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -124,35 +125,37 @@ func (r ApiManagementNotificationRecipientUserResource) Read() sdk.ResourceFunc Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.ApiManagement.NotificationRecipientUserClient - id, err := parse.NotificationRecipientUserID(metadata.ResourceData.Id()) + id, err := notificationrecipientuser.ParseRecipientUserID(metadata.ResourceData.Id()) if err != nil { return err } // CheckEntityExists can not be used, it returns autorest error - users, err := client.ListByNotification(ctx, id.ResourceGroup, id.ServiceName, apimanagement.NotificationName(id.NotificationName)) + notificationId := notificationrecipientuser.NewNotificationID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.NotificationName) + users, err := client.ListByNotification(ctx, notificationId) if err != nil { - if !utils.ResponseWasNotFound(users.Response) { + if !response.WasNotFound(users.HttpResponse) { return fmt.Errorf("retrieving %s: %+v", id, err) } } found := false - if users.Value != nil { - for _, existing := range *users.Value { - if existing.Name != nil && *existing.Name == id.RecipientUserName { + if m := users.Model; m != nil && m.Value != nil { + for _, existing := range *m.Value { + if existing.Name != nil && *existing.Name == id.UserId { found = true } } } + if !found { return metadata.MarkAsGone(id) } model := ApiManagementNotificationRecipientUserModel{ - ApiManagementId: parse.NewApiManagementID(id.SubscriptionId, id.ResourceGroup, id.ServiceName).ID(), - NotificationName: id.NotificationName, - UserId: id.RecipientUserName, + ApiManagementId: apimanagementservice.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName).ID(), + NotificationName: string(id.NotificationName), + UserId: id.UserId, } return metadata.Encode(&model) @@ -166,14 +169,14 @@ func (r ApiManagementNotificationRecipientUserResource) Delete() sdk.ResourceFun Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.ApiManagement.NotificationRecipientUserClient - id, err := parse.NotificationRecipientUserID(metadata.ResourceData.Id()) + id, err := notificationrecipientuser.ParseRecipientUserID(metadata.ResourceData.Id()) if err != nil { return err } - _, err = client.Delete(ctx, id.ResourceGroup, id.ServiceName, apimanagement.NotificationName(id.NotificationName), id.RecipientUserName) + _, err = client.Delete(ctx, *id) if err != nil { - return fmt.Errorf("deleting %s: %+v", id, err) + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/internal/services/apimanagement/api_management_notification_recipient_user_test.go b/internal/services/apimanagement/api_management_notification_recipient_user_test.go index 8ddbaf6f572e..9823ec21c5ce 100644 --- a/internal/services/apimanagement/api_management_notification_recipient_user_test.go +++ b/internal/services/apimanagement/api_management_notification_recipient_user_test.go @@ -8,13 +8,13 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementNotificationRecipientUserResource struct{} @@ -50,25 +50,26 @@ func TestAccApiManagementNotificationRecipientUser_requiresImport(t *testing.T) } func (ApiManagementNotificationRecipientUserResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.NotificationRecipientUserID(state.ID) + id, err := notificationrecipientuser.ParseRecipientUserID(state.ID) if err != nil { return nil, err } - users, err := client.ApiManagement.NotificationRecipientUserClient.ListByNotification(ctx, id.ResourceGroup, id.ServiceName, apimanagement.NotificationName(id.NotificationName)) + notificationId := notificationrecipientuser.NewNotificationID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.NotificationName) + users, err := client.ApiManagement.NotificationRecipientUserClient.ListByNotification(ctx, notificationId) if err != nil { - if !utils.ResponseWasNotFound(users.Response) { - return nil, fmt.Errorf("retrieving Api Management Notification Recipient User %q (Resource Group %q): %+v", id.RecipientUserName, id.ResourceGroup, err) + if !response.WasNotFound(users.HttpResponse) { + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } } - if users.Value != nil { - for _, existing := range *users.Value { - if existing.Name != nil && *existing.Name == id.RecipientUserName { - return utils.Bool(true), nil + if model := users.Model; model != nil && model.Value != nil { + for _, existing := range *model.Value { + if existing.Name != nil && *existing.Name == id.UserId { + return pointer.To(true), nil } } } - return utils.Bool(false), nil + return pointer.To(false), nil } func (r ApiManagementNotificationRecipientUserResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_openid_connect_provider_resource.go b/internal/services/apimanagement/api_management_openid_connect_provider_resource.go index cdc455c4df77..d26e4427a687 100644 --- a/internal/services/apimanagement/api_management_openid_connect_provider_resource.go +++ b/internal/services/apimanagement/api_management_openid_connect_provider_resource.go @@ -8,16 +8,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementOpenIDConnectProvider() *pluginsdk.Resource { @@ -27,7 +27,7 @@ func resourceApiManagementOpenIDConnectProvider() *pluginsdk.Resource { Update: resourceApiManagementOpenIDConnectProviderCreateUpdate, Delete: resourceApiManagementOpenIDConnectProviderDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.OpenIDConnectProviderID(id) + _, err := openidconnectprovider.ParseOpenidConnectProviderID(id) return err }), @@ -85,32 +85,32 @@ func resourceApiManagementOpenIDConnectProviderCreateUpdate(d *pluginsdk.Resourc ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewOpenIDConnectProviderID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) + id := openidconnectprovider.NewOpenidConnectProviderID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_openid_connect_provider", id.ID()) } } - parameters := apimanagement.OpenidConnectProviderContract{ - OpenidConnectProviderContractProperties: &apimanagement.OpenidConnectProviderContractProperties{ - ClientID: utils.String(d.Get("client_id").(string)), - ClientSecret: utils.String(d.Get("client_secret").(string)), - Description: utils.String(d.Get("description").(string)), - DisplayName: utils.String(d.Get("display_name").(string)), - MetadataEndpoint: utils.String(d.Get("metadata_endpoint").(string)), + parameters := openidconnectprovider.OpenidConnectProviderContract{ + Properties: &openidconnectprovider.OpenidConnectProviderContractProperties{ + ClientId: d.Get("client_id").(string), + ClientSecret: pointer.To(d.Get("client_secret").(string)), + Description: pointer.To(d.Get("description").(string)), + DisplayName: d.Get("display_name").(string), + MetadataEndpoint: d.Get("metadata_endpoint").(string), }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.Name, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, openidconnectprovider.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -124,30 +124,32 @@ func resourceApiManagementOpenIDConnectProviderRead(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.OpenIDConnectProviderID(d.Id()) + id, err := openidconnectprovider.ParseOpenidConnectProviderID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s was not found - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("reading %s: %+v", *id, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) - if props := resp.OpenidConnectProviderContractProperties; props != nil { - d.Set("client_id", props.ClientID) - d.Set("description", props.Description) - d.Set("display_name", props.DisplayName) - d.Set("metadata_endpoint", props.MetadataEndpoint) + if model := resp.Model; model != nil { + d.Set("name", pointer.From(model.Name)) + if props := model.Properties; props != nil { + d.Set("client_id", props.ClientId) + d.Set("description", pointer.From(props.Description)) + d.Set("display_name", props.DisplayName) + d.Set("metadata_endpoint", props.MetadataEndpoint) + } } return nil @@ -158,13 +160,13 @@ func resourceApiManagementOpenIDConnectProviderDelete(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.OpenIDConnectProviderID(d.Id()) + id, err := openidconnectprovider.ParseOpenidConnectProviderID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.Name, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id, openidconnectprovider.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_openid_connect_provider_resource_test.go b/internal/services/apimanagement/api_management_openid_connect_provider_resource_test.go index e83457cf566a..7b404115b4b2 100644 --- a/internal/services/apimanagement/api_management_openid_connect_provider_resource_test.go +++ b/internal/services/apimanagement/api_management_openid_connect_provider_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementOpenIDConnectProviderResource struct{} @@ -71,17 +71,17 @@ func TestAccApiManagementOpenIDConnectProvider_update(t *testing.T) { } func (ApiManagementOpenIDConnectProviderResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.OpenIDConnectProviderID(state.ID) + id, err := openidconnectprovider.ParseOpenidConnectProviderID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.OpenIdConnectClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := clients.ApiManagement.OpenIdConnectClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (r ApiManagementOpenIDConnectProviderResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_policy_resource.go b/internal/services/apimanagement/api_management_policy_resource.go index 5024d5113b51..2825c4c23aac 100644 --- a/internal/services/apimanagement/api_management_policy_resource.go +++ b/internal/services/apimanagement/api_management_policy_resource.go @@ -9,14 +9,14 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementPolicy() *pluginsdk.Resource { @@ -27,13 +27,14 @@ func resourceApiManagementPolicy() *pluginsdk.Resource { Delete: resourceApiManagementPolicyDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.PolicyID(id) + _, err := policy.ParseServiceID(id) return err }), - SchemaVersion: 1, + SchemaVersion: 2, StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ - 0: migration.ApiManagementApiPolicyV0ToV1{}, + 0: migration.ApiManagementPolicyV0ToV1{}, + 1: migration.ApiManagementPolicyV1ToV2{}, }), Timeouts: &pluginsdk.ResourceTimeout{ @@ -48,7 +49,7 @@ func resourceApiManagementPolicy() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ApiManagementID, + ValidateFunc: apimanagementservice.ValidateServiceID, }, "xml_content": { @@ -76,11 +77,11 @@ func resourceApiManagementPolicyCreateUpdate(d *pluginsdk.ResourceData, meta int defer cancel() apiManagementID := d.Get("api_management_id").(string) - apiMgmtId, err := parse.ApiManagementID(apiManagementID) + apiMgmtId, err := apimanagementservice.ParseServiceID(apiManagementID) if err != nil { return err } - resourceGroup := apiMgmtId.ResourceGroup + resourceGroup := apiMgmtId.ResourceGroupName serviceName := apiMgmtId.ServiceName /* @@ -89,15 +90,15 @@ func resourceApiManagementPolicyCreateUpdate(d *pluginsdk.ResourceData, meta int Instead of the usual check, the resource documentation clearly states that any existing policy will be overwritten if the resource is used. */ - parameters := apimanagement.PolicyContract{} + parameters := policy.PolicyContract{} xmlContent := d.Get("xml_content").(string) xmlLink := d.Get("xml_link").(string) if xmlLink != "" { - parameters.PolicyContractProperties = &apimanagement.PolicyContractProperties{ - Format: apimanagement.PolicyContentFormatRawxmlLink, - Value: utils.String(xmlLink), + parameters.Properties = &policy.PolicyContractProperties{ + Format: pointer.To(policy.PolicyContentFormatRawxmlNegativelink), + Value: xmlLink, } } else if xmlContent != "" { // this is intentionally an else-if since `xml_content` is computed @@ -107,22 +108,23 @@ func resourceApiManagementPolicyCreateUpdate(d *pluginsdk.ResourceData, meta int d.Set("xml_link", "") } - parameters.PolicyContractProperties = &apimanagement.PolicyContractProperties{ - Format: apimanagement.PolicyContentFormatRawxml, - Value: utils.String(xmlContent), + parameters.Properties = &policy.PolicyContractProperties{ + Format: pointer.To(policy.PolicyContentFormatRawxml), + Value: xmlContent, } } - if parameters.PolicyContractProperties == nil { + if parameters.Properties == nil { return fmt.Errorf("Either `xml_content` or `xml_link` must be set") } - _, err = client.CreateOrUpdate(ctx, resourceGroup, serviceName, parameters, "") + policyServiceId := policy.NewServiceID(apiMgmtId.SubscriptionId, resourceGroup, serviceName) + _, err = client.CreateOrUpdate(ctx, policyServiceId, parameters, policy.CreateOrUpdateOperationOptions{}) if err != nil { - return fmt.Errorf("creating or updating Policy (Resource Group %q / API Management Service %q): %+v", resourceGroup, serviceName, err) + return fmt.Errorf("creating %s: %+v", policyServiceId, err) } - id := parse.NewPolicyID(apiMgmtId.SubscriptionId, apiMgmtId.ResourceGroup, apiMgmtId.ServiceName, "policy") + id := policy.NewServiceID(apiMgmtId.SubscriptionId, apiMgmtId.ResourceGroupName, apiMgmtId.ServiceName) d.SetId(id.ID()) return resourceApiManagementPolicyRead(d, meta) @@ -134,46 +136,41 @@ func resourceApiManagementPolicyRead(d *pluginsdk.ResourceData, meta interface{} ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.PolicyID(d.Id()) + id, err := policy.ParseServiceID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - serviceResp, err := serviceClient.Get(ctx, resourceGroup, serviceName) + apimServiceId := apimanagementservice.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName) + serviceResp, err := serviceClient.Get(ctx, apimServiceId) if err != nil { - if utils.ResponseWasNotFound(serviceResp.Response) { - log.Printf("API Management Service %q was not found in Resource Group %q - removing Policy from state!", serviceName, resourceGroup) + if response.WasNotFound(serviceResp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", apimServiceId) d.SetId("") return nil } - - return fmt.Errorf("making Read request on API Management Service %q (Resource Group %q): %+v", serviceName, resourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", apimServiceId, err) } - d.Set("api_management_id", serviceResp.ID) + if model := serviceResp.Model; model != nil { + d.Set("api_management_id", pointer.From(model.Id)) + } - resp, err := client.Get(ctx, resourceGroup, serviceName, apimanagement.PolicyExportFormatXML) + serviceId := policy.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName) + resp, err := client.Get(ctx, serviceId, policy.GetOperationOptions{Format: pointer.To(policy.PolicyExportFormatXml)}) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Policy (Resource Group %q / API Management Service %q) was not found - removing from state!", resourceGroup, serviceName) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil } - - return fmt.Errorf("making Read request for Policy (Resource Group %q / API Management Service %q): %+v", resourceGroup, serviceName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - if properties := resp.PolicyContractProperties; properties != nil { - policyContent := "" - if pc := properties.Value; pc != nil { - policyContent = html.UnescapeString(*pc) - } - + if model := resp.Model; model != nil && model.Properties != nil { // when you submit an `xml_link` to the API, the API downloads this link and stores it as `xml_content` // as such there is no way to set `xml_link` and we'll let Terraform handle it - d.Set("xml_content", policyContent) + d.Set("xml_content", html.UnescapeString(model.Properties.Value)) } return nil @@ -184,16 +181,14 @@ func resourceApiManagementPolicyDelete(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.PolicyID(d.Id()) + id, err := policy.ParseServiceID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - if resp, err := client.Delete(ctx, resourceGroup, serviceName, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting Policy (Resource Group %q / API Management Service %q): %+v", resourceGroup, serviceName, err) + if resp, err := client.Delete(ctx, *id, policy.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_policy_resource_test.go b/internal/services/apimanagement/api_management_policy_resource_test.go index 6e1457cb7039..f275f5eaf958 100644 --- a/internal/services/apimanagement/api_management_policy_resource_test.go +++ b/internal/services/apimanagement/api_management_policy_resource_test.go @@ -8,12 +8,13 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementPolicyResource struct{} @@ -71,19 +72,18 @@ func TestAccApiManagementPolicy_customPolicy(t *testing.T) { } func (ApiManagementPolicyResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.PolicyID(state.ID) + id, err := policy.ParseServiceID(state.ID) if err != nil { return nil, err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - resp, err := clients.ApiManagement.ServiceClient.Get(ctx, resourceGroup, serviceName) + serviceId := apimanagementservice.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName) + resp, err := clients.ApiManagement.ServiceClient.Get(ctx, serviceId) if err != nil { - return nil, fmt.Errorf("reading ApiManagement Policy (%s): %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementPolicyResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_product_api_resource.go b/internal/services/apimanagement/api_management_product_api_resource.go index d350f82c1ffc..56e6d2218b47 100644 --- a/internal/services/apimanagement/api_management_product_api_resource.go +++ b/internal/services/apimanagement/api_management_product_api_resource.go @@ -8,14 +8,14 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementProductApi() *pluginsdk.Resource { @@ -24,7 +24,7 @@ func resourceApiManagementProductApi() *pluginsdk.Resource { Read: resourceApiManagementProductApiRead, Delete: resourceApiManagementProductApiDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ProductApiID(id) + _, err := productapi.ParseProductApiID(id) return err }), @@ -53,21 +53,21 @@ func resourceApiManagementProductApiCreate(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewProductApiID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("product_id").(string), d.Get("api_name").(string)) + id := productapi.NewProductApiID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("product_id").(string), d.Get("api_name").(string)) - exists, err := client.CheckEntityExists(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, id.ApiName) + exists, err := client.CheckEntityExists(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(exists) { + if !response.WasNotFound(exists.HttpResponse) { return fmt.Errorf("checking for present of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(exists) { + if !response.WasNotFound(exists.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_product_api", id.ID()) } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, id.ApiName); err != nil { - return fmt.Errorf("adding API %q to Product %q (API Management Service %q / Resource Group %q): %+v", id.ApiName, id.ProductName, id.ServiceName, id.ResourceGroup, err) + if _, err := client.CreateOrUpdate(ctx, id); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } d.SetId(id.ID()) @@ -80,15 +80,15 @@ func resourceApiManagementProductApiRead(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ProductApiID(d.Id()) + id, err := productapi.ParseProductApiID(d.Id()) if err != nil { return err } - resp, err := client.CheckEntityExists(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, id.ApiName) + resp, err := client.CheckEntityExists(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp) { - log.Printf("[DEBUG] API %q was not found in Product %q (API Management Service %q / Resource Group %q) was not found - removing from state!", id.ApiName, id.ProductName, id.ServiceName, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s was not found - removing from state", *id) d.SetId("") return nil } @@ -96,9 +96,9 @@ func resourceApiManagementProductApiRead(d *pluginsdk.ResourceData, meta interfa return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("api_name", id.ApiName) - d.Set("product_id", id.ProductName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("api_name", getApiName(id.ApiId)) + d.Set("product_id", id.ProductId) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) return nil @@ -109,14 +109,14 @@ func resourceApiManagementProductApiDelete(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ProductApiID(d.Id()) + id, err := productapi.ParseProductApiID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, id.ApiName); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("removing API %q from Product %q (API Management Service %q / Resource Group %q): %+v", id.ApiName, id.ProductName, id.ServiceName, id.ResourceGroup, err) + if resp, err := client.Delete(ctx, *id); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_product_api_resource_test.go b/internal/services/apimanagement/api_management_product_api_resource_test.go index d3294f0ee706..7d52785e1b9e 100644 --- a/internal/services/apimanagement/api_management_product_api_resource_test.go +++ b/internal/services/apimanagement/api_management_product_api_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementProductAPIResource struct{} @@ -49,16 +49,16 @@ func TestAccApiManagementProductApi_requiresImport(t *testing.T) { } func (ApiManagementProductAPIResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ProductApiID(state.ID) + id, err := productapi.ParseProductApiID(state.ID) if err != nil { return nil, err } - if _, err = clients.ApiManagement.ProductApisClient.CheckEntityExists(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, id.ApiName); err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + if _, err = clients.ApiManagement.ProductApisClient.CheckEntityExists(ctx, *id); err != nil { + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(true), nil + return pointer.To(true), nil } func (ApiManagementProductAPIResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_product_data_source.go b/internal/services/apimanagement/api_management_product_data_source.go index 6cc49f9c2edd..48e79bfe993c 100644 --- a/internal/services/apimanagement/api_management_product_data_source.go +++ b/internal/services/apimanagement/api_management_product_data_source.go @@ -7,14 +7,14 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceApiManagementProduct() *pluginsdk.Resource { @@ -76,27 +76,26 @@ func dataSourceApiManagementProductRead(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewProductID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("product_id").(string)) + id := product.NewProductID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("product_id").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf("%s was not found", id) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("checking for presence of an existing %s: %+v", id, err) } - - return fmt.Errorf("making Read request on %s: %+v", id, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) - if props := resp.ProductContractProperties; props != nil { - d.Set("approval_required", props.ApprovalRequired) - d.Set("description", props.Description) - d.Set("display_name", props.DisplayName) - d.Set("published", props.State == apimanagement.ProductStatePublished) - d.Set("subscriptions_limit", props.SubscriptionsLimit) - d.Set("subscription_required", props.SubscriptionRequired) - d.Set("terms", props.Terms) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("approval_required", pointer.From(model.Properties.ApprovalRequired)) + d.Set("description", pointer.From(model.Properties.Description)) + d.Set("display_name", model.Properties.DisplayName) + d.Set("published", pointer.From(model.Properties.State) == product.ProductStatePublished) + d.Set("subscriptions_limit", pointer.From(model.Properties.SubscriptionsLimit)) + d.Set("subscription_required", pointer.From(model.Properties.SubscriptionRequired)) + d.Set("terms", pointer.From(model.Properties.Terms)) } return nil diff --git a/internal/services/apimanagement/api_management_product_group_resource.go b/internal/services/apimanagement/api_management_product_group_resource.go index 362a909ce693..44359f017f84 100644 --- a/internal/services/apimanagement/api_management_product_group_resource.go +++ b/internal/services/apimanagement/api_management_product_group_resource.go @@ -8,14 +8,14 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementProductGroup() *pluginsdk.Resource { @@ -24,7 +24,7 @@ func resourceApiManagementProductGroup() *pluginsdk.Resource { Read: resourceApiManagementProductGroupRead, Delete: resourceApiManagementProductGroupDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ProductGroupID(id) + _, err := productgroup.ParseProductGroupID(id) return err }), @@ -53,21 +53,21 @@ func resourceApiManagementProductGroupCreate(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewProductGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("product_id").(string), d.Get("group_name").(string)) + id := productgroup.NewProductGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("product_id").(string), d.Get("group_name").(string)) - exists, err := client.CheckEntityExists(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, id.GroupName) + exists, err := client.CheckEntityExists(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(exists) { + if !response.WasNotFound(exists.HttpResponse) { return fmt.Errorf("checking for present of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(exists) { + if !response.WasNotFound(exists.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_product_group", id.ID()) } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, id.GroupName); err != nil { - return fmt.Errorf("adding Product %q to Group %q (API Management Service %q / Resource Group %q): %+v", id.ProductName, id.GroupName, id.ServiceName, id.ResourceGroup, err) + if _, err := client.CreateOrUpdate(ctx, id); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } d.SetId(id.ID()) @@ -80,14 +80,14 @@ func resourceApiManagementProductGroupRead(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ProductGroupID(d.Id()) + id, err := productgroup.ParseProductGroupID(d.Id()) if err != nil { return err } - resp, err := client.CheckEntityExists(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, id.GroupName) + resp, err := client.CheckEntityExists(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -96,9 +96,9 @@ func resourceApiManagementProductGroupRead(d *pluginsdk.ResourceData, meta inter return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("group_name", id.GroupName) - d.Set("product_id", id.ProductName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("group_name", id.GroupId) + d.Set("product_id", id.ProductId) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) return nil @@ -109,13 +109,13 @@ func resourceApiManagementProductGroupDelete(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ProductGroupID(d.Id()) + id, err := productgroup.ParseProductGroupID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, id.GroupName); err != nil { - if !utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id); err != nil { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("removing %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_product_group_resource_test.go b/internal/services/apimanagement/api_management_product_group_resource_test.go index 9903bc6d82a3..c08f1650b07b 100644 --- a/internal/services/apimanagement/api_management_product_group_resource_test.go +++ b/internal/services/apimanagement/api_management_product_group_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementProductGroupResource struct{} @@ -49,16 +49,16 @@ func TestAccApiManagementProductGroup_requiresImport(t *testing.T) { } func (ApiManagementProductGroupResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ProductGroupID(state.ID) + id, err := productgroup.ParseProductGroupID(state.ID) if err != nil { return nil, err } - if _, err = clients.ApiManagement.ProductGroupsClient.CheckEntityExists(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, id.GroupName); err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + if _, err = clients.ApiManagement.ProductGroupsClient.CheckEntityExists(ctx, *id); err != nil { + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(true), nil + return pointer.To(true), nil } func (ApiManagementProductGroupResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_product_policy_resource.go b/internal/services/apimanagement/api_management_product_policy_resource.go index bb0886d0a29c..b7a42aff594b 100644 --- a/internal/services/apimanagement/api_management_product_policy_resource.go +++ b/internal/services/apimanagement/api_management_product_policy_resource.go @@ -9,15 +9,19 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/migration" + + "github.com/hashicorp/go-azure-helpers/lang/response" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementProductPolicy() *pluginsdk.Resource { @@ -27,7 +31,7 @@ func resourceApiManagementProductPolicy() *pluginsdk.Resource { Update: resourceApiManagementProductPolicyCreateUpdate, Delete: resourceApiManagementProductPolicyDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ProductPolicyID(id) + _, err := productpolicy.ParseProductID(id) return err }), @@ -38,6 +42,11 @@ func resourceApiManagementProductPolicy() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, + SchemaVersion: 1, + StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ + 0: migration.ApiManagementProductPolicyV0ToV1{}, + }), + Schema: map[string]*pluginsdk.Schema{ "resource_group_name": commonschema.ResourceGroupName(), @@ -68,45 +77,45 @@ func resourceApiManagementProductPolicyCreateUpdate(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewProductPolicyID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("product_id").(string), string(apimanagement.PolicyExportFormatXML)) + id := productpolicy.NewProductID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("product_id").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, apimanagement.PolicyExportFormat(id.PolicyName)) + existing, err := client.Get(ctx, id, productpolicy.GetOperationOptions{Format: pointer.To(productpolicy.PolicyExportFormatXml)}) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_product_policy", id.ID()) } } - parameters := apimanagement.PolicyContract{} + parameters := productpolicy.PolicyContract{} xmlContent := d.Get("xml_content").(string) xmlLink := d.Get("xml_link").(string) if xmlContent != "" { - parameters.PolicyContractProperties = &apimanagement.PolicyContractProperties{ - Format: apimanagement.PolicyContentFormatRawxml, - Value: utils.String(xmlContent), + parameters.Properties = &productpolicy.PolicyContractProperties{ + Format: pointer.To(productpolicy.PolicyContentFormatRawxml), + Value: xmlContent, } } if xmlLink != "" { - parameters.PolicyContractProperties = &apimanagement.PolicyContractProperties{ - Format: apimanagement.PolicyContentFormatRawxmlLink, - Value: utils.String(xmlLink), + parameters.Properties = &productpolicy.PolicyContractProperties{ + Format: pointer.To(productpolicy.PolicyContentFormatRawxmlNegativelink), + Value: xmlLink, } } - if parameters.PolicyContractProperties == nil { + if parameters.Properties == nil { return fmt.Errorf("Either `xml_content` or `xml_link` must be set") } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, productpolicy.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating or updating %s: %+v", id, err) } d.SetId(id.ID()) @@ -119,33 +128,30 @@ func resourceApiManagementProductPolicyRead(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ProductPolicyID(d.Id()) + id, err := productpolicy.ParseProductID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - productID := id.ProductName - resp, err := client.Get(ctx, resourceGroup, serviceName, productID, apimanagement.PolicyExportFormatXML) + resp, err := client.Get(ctx, *id, productpolicy.GetOperationOptions{Format: pointer.To(productpolicy.PolicyExportFormatXml)}) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Product Policy (Resource Group %q / API Management Service %q / Product %q) was not found - removing from state!", resourceGroup, serviceName, productID) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("making Read request for Product Policy (Resource Group %q / API Management Service %q / Product %q): %+v", resourceGroup, serviceName, productID, err) + return fmt.Errorf("making Read request for %s: %+v", *id, err) } - d.Set("resource_group_name", resourceGroup) - d.Set("api_management_name", serviceName) - d.Set("product_id", productID) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("api_management_name", id.ServiceName) + d.Set("product_id", id.ProductId) - if properties := resp.PolicyContractProperties; properties != nil { + if model := resp.Model; model != nil && model.Properties != nil { // when you submit an `xml_link` to the API, the API downloads this link and stores it as `xml_content` // as such there is no way to set `xml_link` and we'll let Terraform handle it - d.Set("xml_content", html.UnescapeString(*properties.Value)) + d.Set("xml_content", html.UnescapeString(model.Properties.Value)) } return nil @@ -156,17 +162,14 @@ func resourceApiManagementProductPolicyDelete(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ProductPolicyID(d.Id()) + id, err := productpolicy.ParseProductID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - serviceName := id.ServiceName - productID := id.ProductName - if resp, err := client.Delete(ctx, resourceGroup, serviceName, productID, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting Product Policy (Resource Group %q / API Management Service %q / Product %q): %+v", resourceGroup, serviceName, productID, err) + if resp, err := client.Delete(ctx, *id, productpolicy.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_product_policy_resource_test.go b/internal/services/apimanagement/api_management_product_policy_resource_test.go index 273691cb8172..903cf133391f 100644 --- a/internal/services/apimanagement/api_management_product_policy_resource_test.go +++ b/internal/services/apimanagement/api_management_product_policy_resource_test.go @@ -8,13 +8,12 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementProductPolicyResource struct{} @@ -81,17 +80,17 @@ func TestAccApiManagementProductPolicy_update(t *testing.T) { } func (ApiManagementProductPolicyResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ProductPolicyID(state.ID) + id, err := productpolicy.ParseProductID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.ProductPoliciesClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, apimanagement.PolicyExportFormatXML) + resp, err := clients.ApiManagement.ProductPoliciesClient.Get(ctx, *id, productpolicy.GetOperationOptions{Format: pointer.To(productpolicy.PolicyExportFormatXml)}) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementProductPolicyResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_product_resource.go b/internal/services/apimanagement/api_management_product_resource.go index 0fe2c4a07bf2..27fc32bcbe29 100644 --- a/internal/services/apimanagement/api_management_product_resource.go +++ b/internal/services/apimanagement/api_management_product_resource.go @@ -8,16 +8,17 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementProduct() *pluginsdk.Resource { @@ -27,7 +28,7 @@ func resourceApiManagementProduct() *pluginsdk.Resource { Update: resourceApiManagementProductCreateUpdate, Delete: resourceApiManagementProductDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ProductID(id) + _, err := product.ParseProductID(id) return err }), @@ -93,7 +94,7 @@ func resourceApiManagementProductCreateUpdate(d *pluginsdk.ResourceData, meta in log.Printf("[INFO] preparing arguments for API Management Product creation.") - id := parse.NewProductID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("product_id").(string)) + id := product.NewProductID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("product_id").(string)) displayName := d.Get("display_name").(string) description := d.Get("description").(string) @@ -104,42 +105,42 @@ func resourceApiManagementProductCreateUpdate(d *pluginsdk.ResourceData, meta in published := d.Get("published").(bool) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_product", id.ID()) } } - publishedVal := apimanagement.ProductStateNotPublished + publishedVal := product.ProductStateNotPublished if published { - publishedVal = apimanagement.ProductStatePublished + publishedVal = product.ProductStatePublished } - properties := apimanagement.ProductContract{ - ProductContractProperties: &apimanagement.ProductContractProperties{ - Description: utils.String(description), - DisplayName: utils.String(displayName), - State: publishedVal, - SubscriptionRequired: utils.Bool(subscriptionRequired), - Terms: utils.String(terms), + properties := product.ProductContract{ + Properties: &product.ProductContractProperties{ + Description: pointer.To(description), + DisplayName: displayName, + State: pointer.To(publishedVal), + SubscriptionRequired: pointer.To(subscriptionRequired), + Terms: pointer.To(terms), }, } // Swagger says: Can be present only if subscriptionRequired property is present and has a value of false. // API/Portal says: Cannot provide values for approvalRequired and subscriptionsLimit when subscriptionRequired is set to false in the request payload if subscriptionRequired && subscriptionsLimit > 0 { - properties.ProductContractProperties.ApprovalRequired = utils.Bool(approvalRequired) - properties.ProductContractProperties.SubscriptionsLimit = utils.Int32(int32(subscriptionsLimit)) + properties.Properties.ApprovalRequired = pointer.To(approvalRequired) + properties.Properties.SubscriptionsLimit = pointer.To(int64(subscriptionsLimit)) } else if approvalRequired { return fmt.Errorf("`subscription_required` must be true and `subscriptions_limit` must be greater than 0 to use `approval_required`") } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.Name, properties, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, properties, product.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -153,34 +154,33 @@ func resourceApiManagementProductRead(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ProductID(d.Id()) + id, err := product.ParseProductID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("%s was not found - removing from state!", *id) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil } - - return fmt.Errorf("making Read request on %s: %+v", *id, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("product_id", id.Name) + d.Set("product_id", id.ProductId) d.Set("api_management_name", id.ServiceName) - d.Set("resource_group_name", id.ResourceGroup) - - if props := resp.ProductContractProperties; props != nil { - d.Set("approval_required", props.ApprovalRequired) - d.Set("description", props.Description) - d.Set("display_name", props.DisplayName) - d.Set("published", props.State == apimanagement.ProductStatePublished) - d.Set("subscriptions_limit", props.SubscriptionsLimit) - d.Set("subscription_required", props.SubscriptionRequired) - d.Set("terms", props.Terms) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("approval_required", pointer.From(model.Properties.ApprovalRequired)) + d.Set("description", pointer.From(model.Properties.Description)) + d.Set("display_name", model.Properties.DisplayName) + d.Set("published", pointer.From(model.Properties.State) == product.ProductStatePublished) + d.Set("subscriptions_limit", pointer.From(model.Properties.SubscriptionsLimit)) + d.Set("subscription_required", pointer.From(model.Properties.SubscriptionRequired)) + d.Set("terms", pointer.From(model.Properties.Terms)) } return nil @@ -191,16 +191,14 @@ func resourceApiManagementProductDelete(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ProductID(d.Id()) + id, err := product.ParseProductID(d.Id()) if err != nil { return err } log.Printf("[DEBUG] Deleting %s", *id) - deleteSubscriptions := true - resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.Name, "", utils.Bool(deleteSubscriptions)) - if err != nil { - if !utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id, product.DeleteOperationOptions{DeleteSubscriptions: pointer.To(true)}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_product_resource_test.go b/internal/services/apimanagement/api_management_product_resource_test.go index d4ac2e7d9db8..c9df8d67d911 100644 --- a/internal/services/apimanagement/api_management_product_resource_test.go +++ b/internal/services/apimanagement/api_management_product_resource_test.go @@ -9,12 +9,12 @@ import ( "regexp" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementProductResource struct{} @@ -181,17 +181,17 @@ func TestAccApiManagementProduct_subscriptionRequiredDefault(t *testing.T) { } func (ApiManagementProductResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ProductID(state.ID) + id, err := product.ParseProductID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.ProductsClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := clients.ApiManagement.ProductsClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementProductResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_product_tag_resource.go b/internal/services/apimanagement/api_management_product_tag_resource.go index f6fc1fae0bb4..362ff8884db6 100644 --- a/internal/services/apimanagement/api_management_product_tag_resource.go +++ b/internal/services/apimanagement/api_management_product_tag_resource.go @@ -8,14 +8,15 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementProductTag() *pluginsdk.Resource { @@ -24,7 +25,7 @@ func resourceApiManagementProductTag() *pluginsdk.Resource { Read: resourceApiManagementProductTagRead, Delete: resourceApiManagementProductTagDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ProductTagID(id) + _, err := producttag.ParseProductTagID(id) return err }), @@ -48,48 +49,50 @@ func resourceApiManagementProductTag() *pluginsdk.Resource { } func resourceApiManagementProductTagCreate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ApiManagement.TagClient + client := meta.(*clients.Client).ApiManagement.ProductTagClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewProductTagID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("api_management_product_id").(string), d.Get("name").(string)) + id := producttag.NewProductTagID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("api_management_product_id").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.GetByProduct(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, id.TagName) + existing, err := client.TagGetByProduct(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_product_tag", id.ID()) } } - resp, err := client.AssignToProduct(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, id.TagName) + resp, err := client.TagAssignToProduct(ctx, id) if err != nil { return fmt.Errorf(" creating product tag (id : %s): %+v", id, err) } - d.SetId(*resp.ID) + if resp.Model != nil { + d.SetId(pointer.From(resp.Model.Id)) + } return resourceApiManagementProductTagRead(d, meta) } func resourceApiManagementProductTagRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ApiManagement.TagClient + client := meta.(*clients.Client).ApiManagement.ProductTagClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ProductTagID(d.Id()) + id, err := producttag.ParseProductTagID(d.Id()) if err != nil { return err } - resp, err := client.GetByProduct(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, id.TagName) + resp, err := client.TagGetByProduct(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("%s was not found - removing from state!", *id) d.SetId("") return nil @@ -98,33 +101,34 @@ func resourceApiManagementProductTagRead(d *pluginsdk.ResourceData, meta interfa return fmt.Errorf("making Read request on %s: %+v", *id, err) } - productTagId, err := parse.ProductTagID(*resp.ID) - if err != nil { - return err + if model := resp.Model; model != nil { + productTagId, err := producttag.ParseProductTagID(*model.Id) + if err != nil { + return err + } + d.Set("api_management_product_id", productTagId.ProductId) + d.Set("api_management_name", productTagId.ServiceName) + d.Set("resource_group_name", productTagId.ResourceGroupName) + d.Set("name", productTagId.TagId) } - d.Set("api_management_product_id", productTagId.ProductName) - d.Set("api_management_name", productTagId.ServiceName) - d.Set("resource_group_name", productTagId.ResourceGroup) - d.Set("name", productTagId.TagName) - return nil } func resourceApiManagementProductTagDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ApiManagement.TagClient + client := meta.(*clients.Client).ApiManagement.ProductTagClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ProductTagID(d.Id()) + id, err := producttag.ParseProductTagID(d.Id()) if err != nil { return err } log.Printf("[DEBUG] Deleting %s", *id) - resp, err := client.DetachFromProduct(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, id.TagName) + resp, err := client.TagDetachFromProduct(ctx, *id) if err != nil { - if !utils.ResponseWasNotFound(resp) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_product_tag_resource_test.go b/internal/services/apimanagement/api_management_product_tag_resource_test.go index fc2357db340e..6bf85f3fafd5 100644 --- a/internal/services/apimanagement/api_management_product_tag_resource_test.go +++ b/internal/services/apimanagement/api_management_product_tag_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementProductTagResource struct{} @@ -53,17 +53,17 @@ func TestAccApiManagementProductTag_requiresImport(t *testing.T) { } func (ApiManagementProductTagResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ProductTagID(state.ID) + id, err := producttag.ParseProductTagID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.TagClient.GetByProduct(ctx, id.ResourceGroup, id.ServiceName, id.ProductName, id.TagName) + resp, err := clients.ApiManagement.ProductTagClient.TagGetByProduct(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementProductTagResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_redis_cache_resource.go b/internal/services/apimanagement/api_management_redis_cache_resource.go index de6c0e6a44d6..48f6233a5c53 100644 --- a/internal/services/apimanagement/api_management_redis_cache_resource.go +++ b/internal/services/apimanagement/api_management_redis_cache_resource.go @@ -9,17 +9,18 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementRedisCache() *pluginsdk.Resource { @@ -37,7 +38,7 @@ func resourceApiManagementRedisCache() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.RedisCacheID(id) + _, err := cache.ParseCacheID(id) return err }), @@ -53,7 +54,7 @@ func resourceApiManagementRedisCache() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ApiManagementID, + ValidateFunc: apimanagementservice.ValidateServiceID, }, "connection_string": { @@ -98,41 +99,41 @@ func resourceApiManagementRedisCacheCreateUpdate(d *pluginsdk.ResourceData, meta } name := d.Get("name").(string) - apimId, err := parse.ApiManagementID(d.Get("api_management_id").(string)) + apimId, err := apimanagementservice.ParseServiceID(d.Get("api_management_id").(string)) if err != nil { return err } - id := parse.NewRedisCacheID(subscriptionId, apimId.ResourceGroup, apimId.ServiceName, name) + id := cache.NewCacheID(subscriptionId, apimId.ResourceGroupName, apimId.ServiceName, name) if d.IsNewResource() { - existing, err := client.Get(ctx, apimId.ResourceGroup, apimId.ServiceName, name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing %q: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_redis_cache", id.ID()) } } - parameters := apimanagement.CacheContract{ - CacheContractProperties: &apimanagement.CacheContractProperties{ - ConnectionString: utils.String(d.Get("connection_string").(string)), - UseFromLocation: utils.String(location.Normalize(d.Get("cache_location").(string))), + parameters := cache.CacheContract{ + Properties: &cache.CacheContractProperties{ + ConnectionString: d.Get("connection_string").(string), + UseFromLocation: location.Normalize(d.Get("cache_location").(string)), }, } if v, ok := d.GetOk("description"); ok && v.(string) != "" { - parameters.CacheContractProperties.Description = utils.String(v.(string)) + parameters.Properties.Description = pointer.To(v.(string)) } if v, ok := d.GetOk("redis_cache_id"); ok && v.(string) != "" { - parameters.CacheContractProperties.ResourceID = utils.String(*resourceManagerEndpoint + v.(string)) + parameters.Properties.ResourceId = pointer.To(*resourceManagerEndpoint + v.(string)) } // here we use "PUT" for updating, because `description` is not allowed to be empty string, Then we could not update to remove `description` by `PATCH` - if _, err := client.CreateOrUpdate(ctx, apimId.ResourceGroup, apimId.ServiceName, name, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, cache.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/ updating %q: %+v", id, err) } @@ -151,32 +152,32 @@ func resourceApiManagementRedisCacheRead(d *pluginsdk.ResourceData, meta interfa return fmt.Errorf("could not determine Resource Manager endpoint suffix for environment %q", meta.(*clients.Client).Account.Environment.Name) } - id, err := parse.RedisCacheID(d.Id()) + id, err := cache.ParseCacheID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.CacheName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] apimanagement %q does not exist - removing from state", d.Id()) d.SetId("") return nil } return fmt.Errorf("retrieving %q: %+v", id, err) } - d.Set("name", id.CacheName) - d.Set("api_management_id", parse.NewApiManagementID(subscriptionId, id.ResourceGroup, id.ServiceName).ID()) - if props := resp.CacheContractProperties; props != nil { - d.Set("description", props.Description) + d.Set("name", id.CacheId) + d.Set("api_management_id", apimanagementservice.NewServiceID(subscriptionId, id.ResourceGroupName, id.ServiceName).ID()) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("description", pointer.From(model.Properties.Description)) cacheId := "" - if props.ResourceID != nil { + if model.Properties.ResourceId != nil { // correct the resourceID issue: "https://management.azure.com//subscriptions/xx/resourceGroups/xx/providers/Microsoft.Cache/Redis/xx" - cacheId = strings.TrimPrefix(*props.ResourceID, *resourceManagerEndpoint) + cacheId = strings.TrimPrefix(*model.Properties.ResourceId, *resourceManagerEndpoint) } d.Set("redis_cache_id", cacheId) - d.Set("cache_location", props.UseFromLocation) + d.Set("cache_location", model.Properties.UseFromLocation) } return nil } @@ -186,12 +187,12 @@ func resourceApiManagementRedisCacheDelete(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.RedisCacheID(d.Id()) + id, err := cache.ParseCacheID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.CacheName, "*"); err != nil { + if _, err := client.Delete(ctx, *id, cache.DeleteOperationOptions{IfMatch: pointer.To("*")}); err != nil { return fmt.Errorf("deleting %q: %+v", id, err) } return nil diff --git a/internal/services/apimanagement/api_management_redis_cache_resource_test.go b/internal/services/apimanagement/api_management_redis_cache_resource_test.go index 8d0266e4e9e7..e42034482ae2 100644 --- a/internal/services/apimanagement/api_management_redis_cache_resource_test.go +++ b/internal/services/apimanagement/api_management_redis_cache_resource_test.go @@ -8,12 +8,13 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApimanagementRedisCacheResource struct{} @@ -96,18 +97,18 @@ func TestAccApiManagementRedisCache_update(t *testing.T) { } func (r ApimanagementRedisCacheResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.RedisCacheID(state.ID) + id, err := cache.ParseCacheID(state.ID) if err != nil { return nil, err } - resp, err := client.ApiManagement.CacheClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.CacheName) + resp, err := client.ApiManagement.CacheClient.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return utils.Bool(false), nil + if response.WasNotFound(resp.HttpResponse) { + return pointer.To(false), nil } return nil, fmt.Errorf("retrieving %q %+v", id, err) } - return utils.Bool(true), nil + return pointer.To(true), nil } func (r ApimanagementRedisCacheResource) template(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_resource.go b/internal/services/apimanagement/api_management_resource.go index 512393432a8e..1b746bd931f9 100644 --- a/internal/services/apimanagement/api_management_resource.go +++ b/internal/services/apimanagement/api_management_resource.go @@ -11,28 +11,34 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" apimValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) var ( @@ -63,7 +69,7 @@ func resourceApiManagementService() *pluginsdk.Resource { Update: resourceApiManagementServiceCreateUpdate, Delete: resourceApiManagementServiceDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApiManagementID(id) + _, err := apimanagementservice.ParseServiceID(id) return err }), @@ -81,9 +87,9 @@ func resourceApiManagementService() *pluginsdk.Resource { // Issue: https://github.com/Azure/azure-rest-api-specs/issues/10395 CustomizeDiff: pluginsdk.CustomDiffWithAll( pluginsdk.ForceNewIfChange("virtual_network_type", func(ctx context.Context, old, new, meta interface{}) bool { - return !(old.(string) == string(apimanagement.VirtualNetworkTypeNone) && - (new.(string) == string(apimanagement.VirtualNetworkTypeInternal) || - new.(string) == string(apimanagement.VirtualNetworkTypeExternal))) + return !(old.(string) == string(apimanagementservice.VirtualNetworkTypeNone) && + (new.(string) == string(apimanagementservice.VirtualNetworkTypeInternal) || + new.(string) == string(apimanagementservice.VirtualNetworkTypeExternal))) }), pluginsdk.ForceNewIfChange("virtual_network_configuration", func(ctx context.Context, old, new, meta interface{}) bool { @@ -124,11 +130,11 @@ func resourceApiManagementSchema() map[string]*pluginsdk.Schema { "virtual_network_type": { Type: pluginsdk.TypeString, Optional: true, - Default: string(apimanagement.VirtualNetworkTypeNone), + Default: string(apimanagementservice.VirtualNetworkTypeNone), ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.VirtualNetworkTypeNone), - string(apimanagement.VirtualNetworkTypeExternal), - string(apimanagement.VirtualNetworkTypeInternal), + string(apimanagementservice.VirtualNetworkTypeNone), + string(apimanagementservice.VirtualNetworkTypeExternal), + string(apimanagementservice.VirtualNetworkTypeInternal), }, false), }, @@ -260,8 +266,8 @@ func resourceApiManagementSchema() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.StoreNameCertificateAuthority), - string(apimanagement.StoreNameRoot), + string(apimanagementservice.StoreNameCertificateAuthority), + string(apimanagementservice.StoreNameRoot), }, false), }, @@ -656,7 +662,7 @@ func resourceApiManagementSchema() map[string]*pluginsdk.Schema { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), } } @@ -673,17 +679,16 @@ func resourceApiManagementServiceCreateUpdate(d *pluginsdk.ResourceData, meta in log.Printf("[INFO] preparing arguments for API Management Service creation.") - id := parse.NewApiManagementID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := apimanagementservice.NewServiceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing %s: %s", id, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of an existing %s: %+v", id, err) } } - - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management", id.ID()) } } @@ -695,29 +700,30 @@ func resourceApiManagementServiceCreateUpdate(d *pluginsdk.ResourceData, meta in notificationSenderEmail := d.Get("notification_sender_email").(string) virtualNetworkType := d.Get("virtual_network_type").(string) - customProperties, err := expandApiManagementCustomProperties(d, sku.Name == apimanagement.SkuTypeConsumption) + customProperties, err := expandApiManagementCustomProperties(d, sku.Name == apimanagementservice.SkuTypeConsumption) if err != nil { return err } certificates := expandAzureRmApiManagementCertificates(d) - publicNetworkAccess := apimanagement.PublicNetworkAccessEnabled + publicNetworkAccess := apimanagementservice.PublicNetworkAccessEnabled if !d.Get("public_network_access_enabled").(bool) { - publicNetworkAccess = apimanagement.PublicNetworkAccessDisabled + publicNetworkAccess = apimanagementservice.PublicNetworkAccessDisabled } if d.IsNewResource() { // before creating check to see if the resource exists in the soft delete state - softDeleted, err := deletedServicesClient.GetByName(ctx, id.ServiceName, location) + deletedServiceId := deletedservice.NewDeletedServiceID(id.SubscriptionId, location, id.ServiceName) + softDeleted, err := deletedServicesClient.GetByName(ctx, deletedServiceId) if err != nil { // If Terraform lacks permission to read at the Subscription we'll get 403, not 404 - if !utils.ResponseWasNotFound(softDeleted.Response) && !utils.ResponseWasForbidden(softDeleted.Response) { + if !response.WasNotFound(softDeleted.HttpResponse) && !response.WasForbidden(softDeleted.HttpResponse) { return fmt.Errorf("checking for the presence of an existing Soft-Deleted API Management %q (Location %q): %+v", id.ServiceName, location, err) } } // if so, does the user want us to recover it? - if !utils.ResponseWasNotFound(softDeleted.Response) && !utils.ResponseWasForbidden(softDeleted.Response) { + if !response.WasNotFound(softDeleted.HttpResponse) && !response.WasForbidden(softDeleted.HttpResponse) { if !meta.(*clients.Client).Features.ApiManagement.RecoverSoftDeleted { // this exists but the users opted out, so they must import this it out-of-band return fmt.Errorf(optedOutOfRecoveringSoftDeletedApiManagementErrorFmt(id.ServiceName, location)) @@ -725,16 +731,16 @@ func resourceApiManagementServiceCreateUpdate(d *pluginsdk.ResourceData, meta in // First recover the deleted API Management, since all other properties are ignored during a restore operation // (don't set the ID just yet to avoid tainting on failure) - params := apimanagement.ServiceResource{ - Location: utils.String(location), - ServiceProperties: &apimanagement.ServiceProperties{ - Restore: utils.Bool(true), + params := apimanagementservice.ApiManagementServiceResource{ + Location: location, + Properties: apimanagementservice.ApiManagementServiceProperties{ + Restore: pointer.To(true), }, + Sku: sku, } // We only handle the error here because no request body is returned https://github.com/Azure/azure-rest-api-specs/issues/23456 - _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, params) - if err != nil { + if _, err := client.CreateOrUpdate(ctx, id, params); err != nil { return fmt.Errorf("recovering %s: %+v", id, err) } @@ -747,7 +753,7 @@ func resourceApiManagementServiceCreateUpdate(d *pluginsdk.ResourceData, meta in stateConf := &pluginsdk.StateChangeConf{ Pending: []string{"Deleted", "Activating", "Updating", "Unknown"}, Target: []string{"Succeeded", "Ready"}, - Refresh: apiManagementRefreshFunc(ctx, client, id.ServiceName, id.ResourceGroup), + Refresh: apiManagementRefreshFunc(ctx, client, id), MinTimeout: 1 * time.Minute, ContinuousTargetOccurence: 2, Timeout: time.Until(deadline), @@ -759,26 +765,26 @@ func resourceApiManagementServiceCreateUpdate(d *pluginsdk.ResourceData, meta in } } - properties := apimanagement.ServiceResource{ - Location: utils.String(location), - ServiceProperties: &apimanagement.ServiceProperties{ - PublisherName: pointer.FromString(d.Get("publisher_name").(string)), - PublisherEmail: pointer.FromString(d.Get("publisher_email").(string)), - PublicNetworkAccess: publicNetworkAccess, - CustomProperties: customProperties, + properties := apimanagementservice.ApiManagementServiceResource{ + Location: location, + Properties: apimanagementservice.ApiManagementServiceProperties{ + PublisherName: d.Get("publisher_name").(string), + PublisherEmail: d.Get("publisher_email").(string), + PublicNetworkAccess: pointer.To(publicNetworkAccess), + CustomProperties: pointer.To(customProperties), Certificates: certificates, }, - Sku: &sku, + Sku: sku, Tags: tags.Expand(t), } if _, ok := d.GetOk("hostname_configuration"); ok { - properties.ServiceProperties.HostnameConfigurations = expandAzureRmApiManagementHostnameConfigurations(d) + properties.Properties.HostnameConfigurations = expandAzureRmApiManagementHostnameConfigurations(d) } // intentionally not gated since we specify a default value (of None) in the expand, which we need on updates identityRaw := d.Get("identity").([]interface{}) - identity, err := expandIdentity(identityRaw) + identity, err := identity.ExpandSystemAndUserAssignedMap(identityRaw) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } @@ -786,59 +792,59 @@ func resourceApiManagementServiceCreateUpdate(d *pluginsdk.ResourceData, meta in if _, ok := d.GetOk("additional_location"); ok { var err error - properties.ServiceProperties.AdditionalLocations, err = expandAzureRmApiManagementAdditionalLocations(d, sku) + properties.Properties.AdditionalLocations, err = expandAzureRmApiManagementAdditionalLocations(d, sku) if err != nil { return err } } if notificationSenderEmail != "" { - properties.ServiceProperties.NotificationSenderEmail = ¬ificationSenderEmail + properties.Properties.NotificationSenderEmail = pointer.To(notificationSenderEmail) } if virtualNetworkType != "" { - properties.ServiceProperties.VirtualNetworkType = apimanagement.VirtualNetworkType(virtualNetworkType) + properties.Properties.VirtualNetworkType = pointer.To(apimanagementservice.VirtualNetworkType(virtualNetworkType)) - if virtualNetworkType != string(apimanagement.VirtualNetworkTypeNone) { + if virtualNetworkType != string(apimanagementservice.VirtualNetworkTypeNone) { virtualNetworkConfiguration := expandAzureRmApiManagementVirtualNetworkConfigurations(d) if virtualNetworkConfiguration == nil { return fmt.Errorf("You must specify 'virtual_network_configuration' when 'virtual_network_type' is %q", virtualNetworkType) } - properties.ServiceProperties.VirtualNetworkConfiguration = virtualNetworkConfiguration + properties.Properties.VirtualNetworkConfiguration = virtualNetworkConfiguration } } if publicIpAddressId != "" { - if sku.Name != apimanagement.SkuTypePremium && sku.Name != apimanagement.SkuTypeDeveloper { - if virtualNetworkType == string(apimanagement.VirtualNetworkTypeNone) { + if sku.Name != apimanagementservice.SkuTypePremium && sku.Name != apimanagementservice.SkuTypeDeveloper { + if virtualNetworkType == string(apimanagementservice.VirtualNetworkTypeNone) { return fmt.Errorf("`public_ip_address_id` is only supported when sku type is `Developer` or `Premium`, and the APIM instance is deployed in a virtual network.") } } - properties.ServiceProperties.PublicIPAddressID = utils.String(publicIpAddressId) + properties.Properties.PublicIPAddressId = pointer.To(publicIpAddressId) } if d.HasChange("client_certificate_enabled") { enableClientCertificate := d.Get("client_certificate_enabled").(bool) - if enableClientCertificate && sku.Name != apimanagement.SkuTypeConsumption { + if enableClientCertificate && sku.Name != apimanagementservice.SkuTypeConsumption { return fmt.Errorf("`client_certificate_enabled` is only supported when sku type is `Consumption`") } - properties.ServiceProperties.EnableClientCertificate = utils.Bool(enableClientCertificate) + properties.Properties.EnableClientCertificate = pointer.To(enableClientCertificate) } gateWayDisabled := d.Get("gateway_disabled").(bool) - if gateWayDisabled && len(*properties.AdditionalLocations) == 0 { + if gateWayDisabled && len(*properties.Properties.AdditionalLocations) == 0 { return fmt.Errorf("`gateway_disabled` is only supported when `additional_location` is set") } - properties.ServiceProperties.DisableGateway = utils.Bool(gateWayDisabled) + properties.Properties.DisableGateway = pointer.To(gateWayDisabled) if v, ok := d.GetOk("min_api_version"); ok { - properties.ServiceProperties.APIVersionConstraint = &apimanagement.APIVersionConstraint{ - MinAPIVersion: utils.String(v.(string)), + properties.Properties.ApiVersionConstraint = &apimanagementservice.ApiVersionConstraint{ + MinApiVersion: pointer.To(v.(string)), } } if v := d.Get("zones").(*schema.Set).List(); len(v) > 0 { - if sku.Name != apimanagement.SkuTypePremium { + if sku.Name != apimanagementservice.SkuTypePremium { return fmt.Errorf("`zones` is only supported when sku type is `Premium`") } @@ -849,144 +855,135 @@ func resourceApiManagementServiceCreateUpdate(d *pluginsdk.ResourceData, meta in properties.Zones = &zones } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, properties) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) - } - d.SetId(id.ID()) // Remove sample products and APIs after creating (v3.0 behaviour) if d.IsNewResource() { - apis := make([]apimanagement.APIContract, 0) + apiServiceId := api.NewServiceID(subscriptionId, id.ResourceGroupName, id.ServiceName) - for apisIter, err := apiClient.ListByService(ctx, id.ResourceGroup, id.ServiceName, "", nil, nil, "", nil); apisIter.NotDone(); err = apisIter.NextWithContext(ctx) { - if err != nil { - return fmt.Errorf("listing APIs after creation of %s: %+v", id, err) - } - if apisIter.Response().IsEmpty() { - break - } - if apisList := apisIter.Values(); apisList != nil { - apis = append(apis, apisList...) - } + listResp, err := apiClient.ListByService(ctx, apiServiceId, api.ListByServiceOperationOptions{}) + if err != nil { + return fmt.Errorf("listing APIs after creation of %s: %+v", id, err) } - - for _, api := range apis { - if api.ID == nil { - continue - } - apiId, err := parse.ApiID(*api.ID) - if err != nil { - return fmt.Errorf("parsing API ID: %+v", err) - } - log.Printf("[DEBUG] Deleting %s", apiId) - if resp, err := apiClient.Delete(ctx, apiId.ResourceGroup, apiId.ServiceName, apiId.Name, "", utils.Bool(true)); err != nil && !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting %s: %+v", apiId, err) + if model := listResp.Model; model != nil { + for _, contract := range *model { + if contract.Id == nil { + continue + } + apiId, err := api.ParseApiID(pointer.From(contract.Id)) + if err != nil { + return fmt.Errorf("parsing API ID: %+v", err) + } + log.Printf("[DEBUG] Deleting %s", apiId) + if delResp, err := apiClient.Delete(ctx, *apiId, api.DeleteOperationOptions{DeleteRevisions: pointer.To(true)}); err != nil { + if !response.WasNotFound(delResp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *apiId, err) + } + } } } - products := make([]apimanagement.ProductContract, 0) - - for productsIter, err := productsClient.ListByService(ctx, id.ResourceGroup, id.ServiceName, "", nil, nil, nil, ""); productsIter.NotDone(); err = productsIter.NextWithContext(ctx) { - if err != nil { - return fmt.Errorf("listing products after creation of %s: %+v", id, err) - } - if productsIter.Response().IsEmpty() { - break - } - if productList := productsIter.Values(); products != nil { - products = append(products, productList...) - } + produceServiceId := product.NewServiceID(subscriptionId, id.ResourceGroupName, id.ServiceName) + proListResp, err := productsClient.ListByService(ctx, produceServiceId, product.ListByServiceOperationOptions{}) + if err != nil { + return fmt.Errorf("listing products after creation of %s: %+v", id, err) } - - for _, product := range products { - if product.ID == nil { - continue - } - productId, err := parse.ProductID(*product.ID) - if err != nil { - return fmt.Errorf("parsing product ID: %+v", err) - } - log.Printf("[DEBUG] Deleting %s", productId) - if resp, err := productsClient.Delete(ctx, productId.ResourceGroup, productId.ServiceName, productId.Name, "", utils.Bool(true)); err != nil && !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting %s: %+v", productId, err) + if model := proListResp.Model; model != nil { + for _, contract := range *model { + if contract.Id == nil { + continue + } + productId, err := product.ParseProductID(pointer.From(contract.Id)) + if err != nil { + return fmt.Errorf("parsing product ID: %+v", err) + } + log.Printf("[DEBUG] Deleting %s", productId) + if delResp, err := productsClient.Delete(ctx, *productId, product.DeleteOperationOptions{DeleteSubscriptions: pointer.To(true)}); err != nil { + if !response.WasNotFound(delResp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *productId, err) + } + } } } } signInSettingsRaw := d.Get("sign_in").([]interface{}) - if sku.Name == apimanagement.SkuTypeConsumption && len(signInSettingsRaw) > 0 { + if sku.Name == apimanagementservice.SkuTypeConsumption && len(signInSettingsRaw) > 0 { return fmt.Errorf("`sign_in` is not support for sku tier `Consumption`") } - if sku.Name != apimanagement.SkuTypeConsumption { + if sku.Name != apimanagementservice.SkuTypeConsumption { + signInSettingServiceId := signinsettings.NewServiceID(subscriptionId, id.ResourceGroupName, id.ServiceName) signInSettings := expandApiManagementSignInSettings(signInSettingsRaw) signInClient := meta.(*clients.Client).ApiManagement.SignInClient - if _, err := signInClient.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, signInSettings, ""); err != nil { + if _, err := signInClient.CreateOrUpdate(ctx, signInSettingServiceId, signInSettings, signinsettings.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf(" setting Sign In settings for %s: %+v", id, err) } } signUpSettingsRaw := d.Get("sign_up").([]interface{}) - if sku.Name == apimanagement.SkuTypeConsumption && len(signInSettingsRaw) > 0 { + if sku.Name == apimanagementservice.SkuTypeConsumption && len(signInSettingsRaw) > 0 { return fmt.Errorf("`sign_up` is not support for sku tier `Consumption`") } - if sku.Name != apimanagement.SkuTypeConsumption { + if sku.Name != apimanagementservice.SkuTypeConsumption { + signUpSettingServiceId := signupsettings.NewServiceID(subscriptionId, id.ResourceGroupName, id.ServiceName) signUpSettings := expandApiManagementSignUpSettings(signUpSettingsRaw) signUpClient := meta.(*clients.Client).ApiManagement.SignUpClient - if _, err := signUpClient.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, signUpSettings, ""); err != nil { + if _, err := signUpClient.CreateOrUpdate(ctx, signUpSettingServiceId, signUpSettings, signupsettings.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf(" setting Sign Up settings for %s: %+v", id, err) } } delegationSettingsRaw := d.Get("delegation").([]interface{}) - if sku.Name == apimanagement.SkuTypeConsumption && len(delegationSettingsRaw) > 0 { + if sku.Name == apimanagementservice.SkuTypeConsumption && len(delegationSettingsRaw) > 0 { return fmt.Errorf("`delegation` is not support for sku tier `Consumption`") } - if sku.Name != apimanagement.SkuTypeConsumption && len(delegationSettingsRaw) > 0 { + if sku.Name != apimanagementservice.SkuTypeConsumption && len(delegationSettingsRaw) > 0 { + delegationSettingServiceId := delegationsettings.NewServiceID(subscriptionId, id.ResourceGroupName, id.ServiceName) delegationSettings := expandApiManagementDelegationSettings(delegationSettingsRaw) delegationClient := meta.(*clients.Client).ApiManagement.DelegationSettingsClient - if _, err := delegationClient.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, delegationSettings, ""); err != nil { + if _, err := delegationClient.CreateOrUpdate(ctx, delegationSettingServiceId, delegationSettings, delegationsettings.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf(" setting Delegation settings for %s: %+v", id, err) } } policyClient := meta.(*clients.Client).ApiManagement.PolicyClient policiesRaw := d.Get("policy").([]interface{}) - policy, err := expandApiManagementPolicies(policiesRaw) + policyContract, err := expandApiManagementPolicies(policiesRaw) if err != nil { return err } if d.HasChange("policy") { + policyServiceId := policy.NewServiceID(subscriptionId, id.ResourceGroupName, id.ServiceName) // remove the existing policy - if resp, err := policyClient.Delete(ctx, id.ResourceGroup, id.ServiceName, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { + if delResp, err := policyClient.Delete(ctx, policyServiceId, policy.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(delResp.HttpResponse) { return fmt.Errorf("removing Policies from %s: %+v", id, err) } } // then add the new one, if it exists - if policy != nil { - if _, err := policyClient.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, *policy, ""); err != nil { + if policyContract != nil { + if _, err := policyClient.CreateOrUpdate(ctx, policyServiceId, *policyContract, policy.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf(" setting Policies for %s: %+v", id, err) } } } tenantAccessRaw := d.Get("tenant_access").([]interface{}) - if sku.Name == apimanagement.SkuTypeConsumption && len(tenantAccessRaw) > 0 { + if sku.Name == apimanagementservice.SkuTypeConsumption && len(tenantAccessRaw) > 0 { return fmt.Errorf("`tenant_access` is not supported for sku tier `Consumption`") } - if sku.Name != apimanagement.SkuTypeConsumption && d.HasChange("tenant_access") { + if sku.Name != apimanagementservice.SkuTypeConsumption && d.HasChange("tenant_access") { + tenantAccessServiceId := tenantaccess.NewAccessID(subscriptionId, id.ResourceGroupName, id.ServiceName, "access") tenantAccessInformationParametersRaw := d.Get("tenant_access").([]interface{}) tenantAccessInformationParameters := expandApiManagementTenantAccessSettings(tenantAccessInformationParametersRaw) tenantAccessClient := meta.(*clients.Client).ApiManagement.TenantAccessClient - if _, err := tenantAccessClient.Update(ctx, id.ResourceGroup, id.ServiceName, tenantAccessInformationParameters, "access", ""); err != nil { + if _, err := tenantAccessClient.Update(ctx, tenantAccessServiceId, tenantAccessInformationParameters, tenantaccess.UpdateOperationOptions{}); err != nil { return fmt.Errorf(" updating tenant access settings for %s: %+v", id, err) } } @@ -1003,80 +1000,77 @@ func resourceApiManagementServiceRead(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiManagementID(d.Id()) + id, err := apimanagementservice.ParseServiceID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("%s was not found - removing from state!", *id) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil } - - return fmt.Errorf("making Read request on %s: %+v", *id, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } + policyServiceId := policy.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName) policyClient := meta.(*clients.Client).ApiManagement.PolicyClient - policy, err := policyClient.Get(ctx, id.ResourceGroup, id.ServiceName, apimanagement.PolicyExportFormatXML) + policy, err := policyClient.Get(ctx, policyServiceId, policy.GetOperationOptions{Format: pointer.To(policy.PolicyExportFormatXml)}) if err != nil { - if !utils.ResponseWasNotFound(policy.Response) { + if !response.WasNotFound(policy.HttpResponse) { return fmt.Errorf("retrieving Policy for %s: %+v", *id, err) } } d.Set("name", id.ServiceName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } - - identity, err := flattenIdentity(resp.Identity) - if err != nil { - return fmt.Errorf("flattening `identity`: %+v", err) - } - if err := d.Set("identity", identity); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) - } - - if props := resp.ServiceProperties; props != nil { - d.Set("publisher_email", props.PublisherEmail) - d.Set("publisher_name", props.PublisherName) - d.Set("notification_sender_email", props.NotificationSenderEmail) - d.Set("gateway_url", props.GatewayURL) - d.Set("gateway_regional_url", props.GatewayRegionalURL) - d.Set("portal_url", props.PortalURL) - d.Set("developer_portal_url", props.DeveloperPortalURL) - d.Set("management_api_url", props.ManagementAPIURL) - d.Set("scm_url", props.ScmURL) - d.Set("public_ip_addresses", props.PublicIPAddresses) - d.Set("public_ip_address_id", props.PublicIPAddressID) - d.Set("public_network_access_enabled", props.PublicNetworkAccess == apimanagement.PublicNetworkAccessEnabled) - d.Set("private_ip_addresses", props.PrivateIPAddresses) - d.Set("virtual_network_type", props.VirtualNetworkType) - d.Set("client_certificate_enabled", props.EnableClientCertificate) - d.Set("gateway_disabled", props.DisableGateway) - - d.Set("certificate", flattenAPIManagementCertificates(d, props.Certificates)) - - if resp.Sku != nil && resp.Sku.Name != "" { - if err := d.Set("security", flattenApiManagementSecurityCustomProperties(props.CustomProperties, resp.Sku.Name == apimanagement.SkuTypeConsumption)); err != nil { + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) + identity, err := identity.FlattenSystemAndUserAssignedMap(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + if err := d.Set("identity", identity); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } + + d.Set("publisher_email", model.Properties.PublisherEmail) + d.Set("publisher_name", model.Properties.PublisherName) + d.Set("notification_sender_email", pointer.From(model.Properties.NotificationSenderEmail)) + d.Set("gateway_url", pointer.From(model.Properties.GatewayUrl)) + d.Set("gateway_regional_url", pointer.From(model.Properties.GatewayRegionalUrl)) + d.Set("portal_url", pointer.From(model.Properties.PortalUrl)) + d.Set("developer_portal_url", pointer.From(model.Properties.DeveloperPortalUrl)) + d.Set("management_api_url", pointer.From(model.Properties.ManagementApiUrl)) + d.Set("scm_url", pointer.From(model.Properties.ScmUrl)) + d.Set("public_ip_addresses", pointer.From(model.Properties.PublicIPAddresses)) + d.Set("public_ip_address_id", pointer.From(model.Properties.PublicIPAddressId)) + d.Set("public_network_access_enabled", pointer.From(model.Properties.PublicNetworkAccess) == apimanagementservice.PublicNetworkAccessEnabled) + d.Set("private_ip_addresses", pointer.From(model.Properties.PrivateIPAddresses)) + d.Set("virtual_network_type", pointer.From(model.Properties.VirtualNetworkType)) + d.Set("client_certificate_enabled", pointer.From(model.Properties.EnableClientCertificate)) + d.Set("gateway_disabled", pointer.From(model.Properties.DisableGateway)) + + d.Set("certificate", flattenAPIManagementCertificates(d, model.Properties.Certificates)) + + if model.Sku.Name != "" { + if err := d.Set("security", flattenApiManagementSecurityCustomProperties(*model.Properties.CustomProperties, model.Sku.Name == apimanagementservice.SkuTypeConsumption)); err != nil { return fmt.Errorf("setting `security`: %+v", err) } } - if err := d.Set("protocols", flattenApiManagementProtocolsCustomProperties(props.CustomProperties)); err != nil { + if err := d.Set("protocols", flattenApiManagementProtocolsCustomProperties(*model.Properties.CustomProperties)); err != nil { return fmt.Errorf("setting `protocols`: %+v", err) } - hostnameConfigs := flattenApiManagementHostnameConfigurations(props.HostnameConfigurations, d) + hostnameConfigs := flattenApiManagementHostnameConfigurations(model.Properties.HostnameConfigurations, d) if err := d.Set("hostname_configuration", hostnameConfigs); err != nil { return fmt.Errorf("setting `hostname_configuration`: %+v", err) } - additionalLocation, err := flattenApiManagementAdditionalLocations(props.AdditionalLocations) + additionalLocation, err := flattenApiManagementAdditionalLocations(model.Properties.AdditionalLocations) if err != nil { return err } @@ -1084,7 +1078,7 @@ func resourceApiManagementServiceRead(d *pluginsdk.ResourceData, meta interface{ return fmt.Errorf("setting `additional_location`: %+v", err) } - virtualNetworkConfiguration, err := flattenApiManagementVirtualNetworkConfiguration(props.VirtualNetworkConfiguration) + virtualNetworkConfiguration, err := flattenApiManagementVirtualNetworkConfiguration(model.Properties.VirtualNetworkConfiguration) if err != nil { return err } @@ -1093,70 +1087,75 @@ func resourceApiManagementServiceRead(d *pluginsdk.ResourceData, meta interface{ } var minApiVersion string - if props.APIVersionConstraint != nil && props.APIVersionConstraint.MinAPIVersion != nil { - minApiVersion = *props.APIVersionConstraint.MinAPIVersion + if model.Properties.ApiVersionConstraint != nil { + minApiVersion = pointer.From(model.Properties.ApiVersionConstraint.MinApiVersion) } d.Set("min_api_version", minApiVersion) - } - if err := d.Set("sku_name", flattenApiManagementServiceSkuName(resp.Sku)); err != nil { - return fmt.Errorf("setting `sku_name`: %+v", err) - } + if err := d.Set("sku_name", flattenApiManagementServiceSkuName(&model.Sku)); err != nil { + return fmt.Errorf("setting `sku_name`: %+v", err) + } - if err := d.Set("policy", flattenApiManagementPolicies(d, policy)); err != nil { - return fmt.Errorf("setting `policy`: %+v", err) - } + if err := d.Set("policy", flattenApiManagementPolicies(d, policy.Model)); err != nil { + return fmt.Errorf("setting `policy`: %+v", err) + } - d.Set("zones", zones.FlattenUntyped(resp.Zones)) + d.Set("zones", zones.FlattenUntyped(model.Zones)) - if resp.Sku.Name != apimanagement.SkuTypeConsumption { - signInSettings, err := signInClient.Get(ctx, id.ResourceGroup, id.ServiceName) - if err != nil { - return fmt.Errorf("retrieving Sign In Settings for %s: %+v", *id, err) - } - if err := d.Set("sign_in", flattenApiManagementSignInSettings(signInSettings)); err != nil { - return fmt.Errorf("setting `sign_in`: %+v", err) - } + if model.Sku.Name != apimanagementservice.SkuTypeConsumption { + signInSettingServiceId := signinsettings.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName) + signInSettings, err := signInClient.Get(ctx, signInSettingServiceId) + if err != nil { + return fmt.Errorf("retrieving Sign In Settings for %s: %+v", *id, err) + } + if err := d.Set("sign_in", flattenApiManagementSignInSettings(*signInSettings.Model)); err != nil { + return fmt.Errorf("setting `sign_in`: %+v", err) + } - signUpSettings, err := signUpClient.Get(ctx, id.ResourceGroup, id.ServiceName) - if err != nil { - return fmt.Errorf("retrieving Sign Up Settings for %s: %+v", *id, err) - } + signUpSettingServiceId := signupsettings.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName) + signUpSettings, err := signUpClient.Get(ctx, signUpSettingServiceId) + if err != nil { + return fmt.Errorf("retrieving Sign Up Settings for %s: %+v", *id, err) + } - if err := d.Set("sign_up", flattenApiManagementSignUpSettings(signUpSettings)); err != nil { - return fmt.Errorf("setting `sign_up`: %+v", err) - } + if err := d.Set("sign_up", flattenApiManagementSignUpSettings(*signUpSettings.Model)); err != nil { + return fmt.Errorf("setting `sign_up`: %+v", err) + } - delegationSettings, err := delegationClient.Get(ctx, id.ResourceGroup, id.ServiceName) - if err != nil { - return fmt.Errorf("retrieving Delegation Settings for %s: %+v", *id, err) - } + delegationSettingServiceId := delegationsettings.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName) + delegationSettings, err := delegationClient.Get(ctx, delegationSettingServiceId) + if err != nil { + return fmt.Errorf("retrieving Delegation Settings for %s: %+v", *id, err) + } - delegationValidationKeyContract, err := delegationClient.ListSecrets(ctx, id.ResourceGroup, id.ServiceName) - if err != nil { - return fmt.Errorf("retrieving Delegation Validation Key for %s: %+v", *id, err) - } + delegationValidationKeyContract, err := delegationClient.ListSecrets(ctx, delegationSettingServiceId) + if err != nil { + return fmt.Errorf("retrieving Delegation Validation Key for %s: %+v", *id, err) + } - if err := d.Set("delegation", flattenApiManagementDelegationSettings(delegationSettings, delegationValidationKeyContract)); err != nil { - return fmt.Errorf("setting `delegation`: %+v", err) - } - } else { - d.Set("sign_in", []interface{}{}) - d.Set("sign_up", []interface{}{}) - d.Set("delegation", []interface{}{}) - } + if err := d.Set("delegation", flattenApiManagementDelegationSettings(*delegationSettings.Model, *delegationValidationKeyContract.Model)); err != nil { + return fmt.Errorf("setting `delegation`: %+v", err) + } - if resp.Sku.Name != apimanagement.SkuTypeConsumption { - tenantAccessInformationContract, err := tenantAccessClient.ListSecrets(ctx, id.ResourceGroup, id.ServiceName, "access") - if err != nil { - return fmt.Errorf("retrieving tenant access properties for %s: %+v", *id, err) + tenantAccessServiceId := tenantaccess.NewAccessID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, "access") + tenantAccessInformationContract, err := tenantAccessClient.ListSecrets(ctx, tenantAccessServiceId) + if err != nil { + return fmt.Errorf("retrieving tenant access properties for %s: %+v", *id, err) + } + if err := d.Set("tenant_access", flattenApiManagementTenantAccessSettings(*tenantAccessInformationContract.Model)); err != nil { + return fmt.Errorf("setting `tenant_access`: %+v", err) + } + } else { + d.Set("sign_in", []interface{}{}) + d.Set("sign_up", []interface{}{}) + d.Set("delegation", []interface{}{}) } - if err := d.Set("tenant_access", flattenApiManagementTenantAccessSettings(tenantAccessInformationContract)); err != nil { - return fmt.Errorf("setting `tenant_access`: %+v", err) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceApiManagementServiceDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -1165,71 +1164,62 @@ func resourceApiManagementServiceDelete(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiManagementID(d.Id()) + id, err := apimanagementservice.ParseServiceID(d.Id()) if err != nil { return err } - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName) + existing, err := client.Get(ctx, *id) if err != nil { return fmt.Errorf("retrieving %s: %+v", *id, err) } - location := location.NormalizeNilable(existing.Location) log.Printf("[DEBUG] Deleting %s", *id) - future, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName) - if err != nil { + if err = client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - // TODO: @tombuildsstuff: this NotFound can be removed once this is switched to `go-azure-sdk` - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - } + if model := existing.Model; model != nil { + locationName := location.NormalizeNilable(pointer.To(model.Location)) - // Purge the soft deleted Api Management permanently if the feature flag is enabled - if meta.(*clients.Client).Features.ApiManagement.PurgeSoftDeleteOnDestroy { - log.Printf("[DEBUG] %s marked for purge - executing purge", *id) - if _, err := deletedServicesClient.GetByName(ctx, id.ServiceName, location); err != nil { - return fmt.Errorf("retrieving the deleted %s to be able to purge it: %+v", *id, err) - } - future, err := deletedServicesClient.Purge(ctx, id.ServiceName, location) - if err != nil { - return fmt.Errorf("purging the deleted %s: %+v", *id, err) - } - - log.Printf("[DEBUG] Waiting for purge of %s..", *id) - err = future.WaitForCompletionRef(ctx, deletedServicesClient.Client) - if err != nil { - return fmt.Errorf("waiting for the purge of deleted %s: %+v", *id, err) + // Purge the soft deleted Api Management permanently if the feature flag is enabled + if meta.(*clients.Client).Features.ApiManagement.PurgeSoftDeleteOnDestroy { + log.Printf("[DEBUG] %s marked for purge - executing purge", *id) + deletedServiceId := deletedservice.NewDeletedServiceID(id.SubscriptionId, locationName, id.ServiceName) + if _, err := deletedServicesClient.GetByName(ctx, deletedServiceId); err != nil { + return fmt.Errorf("retrieving the deleted %s to be able to purge it: %+v", *id, err) + } + if resp, err := deletedServicesClient.Purge(ctx, deletedServiceId); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("purging the deleted %s: %+v", *id, err) + } + } + log.Printf("[DEBUG] Purged %s.", *id) + return nil } - log.Printf("[DEBUG] Purged %s.", *id) - return nil } return nil } -func apiManagementRefreshFunc(ctx context.Context, client *apimanagement.ServiceClient, serviceName, resourceGroup string) pluginsdk.StateRefreshFunc { +func apiManagementRefreshFunc(ctx context.Context, client *apimanagementservice.ApiManagementServiceClient, id apimanagementservice.ServiceId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - log.Printf("[DEBUG] Checking to see if API Management Service %q (Resource Group: %q) is available..", serviceName, resourceGroup) + log.Printf("[DEBUG] Checking to see if API Management Service %q (Resource Group: %q) is available..", id.ServiceName, id.ResourceGroupName) - resp, err := client.Get(ctx, resourceGroup, serviceName) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Retrieving API Management %q (Resource Group: %q) returned 404.", serviceName, resourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] Retrieving API Management %q (Resource Group: %q) returned 404.", id.ServiceName, id.ResourceGroupName) return nil, "NotFound", nil } - return nil, "", fmt.Errorf("polling for the state of the API Management Service %q (Resource Group: %q): %+v", serviceName, resourceGroup, err) + return nil, "", fmt.Errorf("polling for the state of the API Management Service %q (Resource Group: %q): %+v", id.ServiceName, id.ResourceGroupName, err) } state := "" - if props := resp.ServiceProperties; props != nil { - if props.ProvisioningState != nil { - state = *props.ProvisioningState + if model := resp.Model; model != nil { + if model.Properties.ProvisioningState != nil { + state = pointer.From(model.Properties.ProvisioningState) } } @@ -1237,8 +1227,8 @@ func apiManagementRefreshFunc(ctx context.Context, client *apimanagement.Service } } -func expandAzureRmApiManagementHostnameConfigurations(d *pluginsdk.ResourceData) *[]apimanagement.HostnameConfiguration { - results := make([]apimanagement.HostnameConfiguration, 0) +func expandAzureRmApiManagementHostnameConfigurations(d *pluginsdk.ResourceData) *[]apimanagementservice.HostnameConfiguration { + results := make([]apimanagementservice.HostnameConfiguration, 0) vs := d.Get("hostname_configuration") if vs == nil { return &results @@ -1252,30 +1242,30 @@ func expandAzureRmApiManagementHostnameConfigurations(d *pluginsdk.ResourceData) managementVs := hostnameV["management"].([]interface{}) for _, managementV := range managementVs { v := managementV.(map[string]interface{}) - output := expandApiManagementCommonHostnameConfiguration(v, apimanagement.HostnameTypeManagement) + output := expandApiManagementCommonHostnameConfiguration(v, apimanagementservice.HostnameTypeManagement) results = append(results, output) } portalVs := hostnameV["portal"].([]interface{}) for _, portalV := range portalVs { v := portalV.(map[string]interface{}) - output := expandApiManagementCommonHostnameConfiguration(v, apimanagement.HostnameTypePortal) + output := expandApiManagementCommonHostnameConfiguration(v, apimanagementservice.HostnameTypePortal) results = append(results, output) } developerPortalVs := hostnameV["developer_portal"].([]interface{}) for _, developerPortalV := range developerPortalVs { v := developerPortalV.(map[string]interface{}) - output := expandApiManagementCommonHostnameConfiguration(v, apimanagement.HostnameTypeDeveloperPortal) + output := expandApiManagementCommonHostnameConfiguration(v, apimanagementservice.HostnameTypeDeveloperPortal) results = append(results, output) } proxyVs := hostnameV["proxy"].([]interface{}) for _, proxyV := range proxyVs { v := proxyV.(map[string]interface{}) - output := expandApiManagementCommonHostnameConfiguration(v, apimanagement.HostnameTypeProxy) + output := expandApiManagementCommonHostnameConfiguration(v, apimanagementservice.HostnameTypeProxy) if value, ok := v["default_ssl_binding"]; ok { - output.DefaultSslBinding = utils.Bool(value.(bool)) + output.DefaultSslBinding = pointer.To(value.(bool)) } results = append(results, output) } @@ -1283,7 +1273,7 @@ func expandAzureRmApiManagementHostnameConfigurations(d *pluginsdk.ResourceData) scmVs := hostnameV["scm"].([]interface{}) for _, scmV := range scmVs { v := scmV.(map[string]interface{}) - output := expandApiManagementCommonHostnameConfiguration(v, apimanagement.HostnameTypeScm) + output := expandApiManagementCommonHostnameConfiguration(v, apimanagementservice.HostnameTypeScm) results = append(results, output) } } @@ -1291,43 +1281,35 @@ func expandAzureRmApiManagementHostnameConfigurations(d *pluginsdk.ResourceData) return &results } -func expandApiManagementCommonHostnameConfiguration(input map[string]interface{}, hostnameType apimanagement.HostnameType) apimanagement.HostnameConfiguration { - output := apimanagement.HostnameConfiguration{ +func expandApiManagementCommonHostnameConfiguration(input map[string]interface{}, hostnameType apimanagementservice.HostnameType) apimanagementservice.HostnameConfiguration { + output := apimanagementservice.HostnameConfiguration{ Type: hostnameType, } - if v, ok := input["certificate"]; ok { - if v.(string) != "" { - output.EncodedCertificate = utils.String(v.(string)) - } + if v, ok := input["certificate"]; ok && v.(string) != "" { + output.EncodedCertificate = pointer.To(v.(string)) } - if v, ok := input["certificate_password"]; ok { - if v.(string) != "" { - output.CertificatePassword = utils.String(v.(string)) - } + if v, ok := input["certificate_password"]; ok && v.(string) != "" { + output.CertificatePassword = pointer.To(v.(string)) } - if v, ok := input["host_name"]; ok { - if v.(string) != "" { - output.HostName = utils.String(v.(string)) - } + if v, ok := input["host_name"]; ok && v.(string) != "" { + output.HostName = v.(string) } - if v, ok := input["key_vault_id"]; ok { - if v.(string) != "" { - output.KeyVaultID = utils.String(v.(string)) - } + if v, ok := input["key_vault_id"]; ok && v.(string) != "" { + output.KeyVaultId = pointer.To(v.(string)) } if v, ok := input["negotiate_client_certificate"]; ok { - output.NegotiateClientCertificate = utils.Bool(v.(bool)) + output.NegotiateClientCertificate = pointer.To(v.(bool)) } - if v, ok := input["ssl_keyvault_identity_client_id"].(string); ok && v != "" { - output.IdentityClientID = utils.String(v) + if v, ok := input["ssl_keyvault_identity_client_id"]; ok && v.(string) != "" { + output.IdentityClientId = pointer.To(v.(string)) } return output } -func flattenApiManagementHostnameConfigurations(input *[]apimanagement.HostnameConfiguration, d *pluginsdk.ResourceData) []interface{} { +func flattenApiManagementHostnameConfigurations(input *[]apimanagementservice.HostnameConfiguration, d *pluginsdk.ResourceData) []interface{} { results := make([]interface{}, 0) if input == nil { return results @@ -1342,67 +1324,43 @@ func flattenApiManagementHostnameConfigurations(input *[]apimanagement.HostnameC for _, config := range *input { output := make(map[string]interface{}) - if config.HostName != nil { - output["host_name"] = *config.HostName - } - - if config.NegotiateClientCertificate != nil { - output["negotiate_client_certificate"] = *config.NegotiateClientCertificate - } - - if config.KeyVaultID != nil { - output["key_vault_id"] = *config.KeyVaultID - } - - if config.IdentityClientID != nil { - output["ssl_keyvault_identity_client_id"] = *config.IdentityClientID - } + output["host_name"] = config.HostName + output["negotiate_client_certificate"] = pointer.From(config.NegotiateClientCertificate) + output["key_vault_id"] = pointer.From(config.KeyVaultId) + output["ssl_keyvault_identity_client_id"] = pointer.From(config.IdentityClientId) if config.Certificate != nil { - if config.Certificate.Expiry != nil && !config.Certificate.Expiry.IsZero() { - output["expiry"] = config.Certificate.Expiry.Format(time.RFC3339) - } - - if config.Certificate.Thumbprint != nil { - output["thumbprint"] = *config.Certificate.Thumbprint - } - - if config.Certificate.Subject != nil { - output["subject"] = *config.Certificate.Subject + if config.Certificate.Expiry != "" { + output["expiry"] = config.Certificate.Expiry } + output["thumbprint"] = config.Certificate.Thumbprint + output["subject"] = config.Certificate.Subject } - if config.CertificateSource != "" { - output["certificate_source"] = config.CertificateSource - } - - if config.CertificateStatus != "" { - output["certificate_status"] = config.CertificateStatus - } + output["certificate_source"] = pointer.From(config.CertificateSource) + output["certificate_status"] = pointer.From(config.CertificateStatus) var configType string switch strings.ToLower(string(config.Type)) { - case strings.ToLower(string(apimanagement.HostnameTypeProxy)): + case strings.ToLower(string(apimanagementservice.HostnameTypeProxy)): // only set SSL binding for proxy types - if config.DefaultSslBinding != nil { - output["default_ssl_binding"] = *config.DefaultSslBinding - } + output["default_ssl_binding"] = pointer.From(config.DefaultSslBinding) proxyResults = append(proxyResults, output) configType = "proxy" - case strings.ToLower(string(apimanagement.HostnameTypeManagement)): + case strings.ToLower(string(apimanagementservice.HostnameTypeManagement)): managementResults = append(managementResults, output) configType = "management" - case strings.ToLower(string(apimanagement.HostnameTypePortal)): + case strings.ToLower(string(apimanagementservice.HostnameTypePortal)): portalResults = append(portalResults, output) configType = "portal" - case strings.ToLower(string(apimanagement.HostnameTypeDeveloperPortal)): + case strings.ToLower(string(apimanagementservice.HostnameTypeDeveloperPortal)): developerPortalResults = append(developerPortalResults, output) configType = "developer_portal" - case strings.ToLower(string(apimanagement.HostnameTypeScm)): + case strings.ToLower(string(apimanagementservice.HostnameTypeScm)): scmResults = append(scmResults, output) configType = "scm" } @@ -1413,7 +1371,7 @@ func flattenApiManagementHostnameConfigurations(input *[]apimanagement.HostnameC if valsRaw, ok := v[configType]; ok { vals := valsRaw.([]interface{}) - schemaz.CopyCertificateAndPassword(vals, *config.HostName, output) + schemaz.CopyCertificateAndPassword(vals, config.HostName, output) } } } @@ -1433,25 +1391,23 @@ func flattenApiManagementHostnameConfigurations(input *[]apimanagement.HostnameC } } -func expandAzureRmApiManagementCertificates(d *pluginsdk.ResourceData) *[]apimanagement.CertificateConfiguration { +func expandAzureRmApiManagementCertificates(d *pluginsdk.ResourceData) *[]apimanagementservice.CertificateConfiguration { vs := d.Get("certificate").([]interface{}) - results := make([]apimanagement.CertificateConfiguration, 0) + results := make([]apimanagementservice.CertificateConfiguration, 0) for _, v := range vs { config := v.(map[string]interface{}) certBase64 := config["encoded_certificate"].(string) - storeName := apimanagement.StoreName(config["store_name"].(string)) + storeName := apimanagementservice.StoreName(config["store_name"].(string)) - cert := apimanagement.CertificateConfiguration{ - EncodedCertificate: utils.String(certBase64), + cert := apimanagementservice.CertificateConfiguration{ + EncodedCertificate: pointer.To(certBase64), StoreName: storeName, } - if certPassword := config["certificate_password"]; certPassword != nil { - cert.CertificatePassword = utils.String(certPassword.(string)) - } + cert.CertificatePassword = pointer.To(config["certificate_password"].(string)) results = append(results, cert) } @@ -1459,24 +1415,24 @@ func expandAzureRmApiManagementCertificates(d *pluginsdk.ResourceData) *[]apiman return &results } -func expandAzureRmApiManagementAdditionalLocations(d *pluginsdk.ResourceData, sku apimanagement.ServiceSkuProperties) (*[]apimanagement.AdditionalLocation, error) { +func expandAzureRmApiManagementAdditionalLocations(d *pluginsdk.ResourceData, sku apimanagementservice.ApiManagementServiceSkuProperties) (*[]apimanagementservice.AdditionalLocation, error) { inputLocations := d.Get("additional_location").([]interface{}) parentVnetConfig := d.Get("virtual_network_configuration").([]interface{}) - additionalLocations := make([]apimanagement.AdditionalLocation, 0) + additionalLocations := make([]apimanagementservice.AdditionalLocation, 0) for _, v := range inputLocations { config := v.(map[string]interface{}) location := azure.NormalizeLocation(config["location"].(string)) if config["capacity"].(int) > 0 { - sku.Capacity = utils.Int32(int32(config["capacity"].(int))) + sku.Capacity = int64(config["capacity"].(int)) } - additionalLocation := apimanagement.AdditionalLocation{ - Location: utils.String(location), - Sku: &sku, - DisableGateway: utils.Bool(config["gateway_disabled"].(bool)), + additionalLocation := apimanagementservice.AdditionalLocation{ + Location: location, + Sku: sku, + DisableGateway: pointer.To(config["gateway_disabled"].(bool)), } childVnetConfig := config["virtual_network_configuration"].([]interface{}) @@ -1488,19 +1444,19 @@ func expandAzureRmApiManagementAdditionalLocations(d *pluginsdk.ResourceData, sk case len(childVnetConfig) > 0 && len(parentVnetConfig) > 0: v := childVnetConfig[0].(map[string]interface{}) subnetResourceId := v["subnet_id"].(string) - additionalLocation.VirtualNetworkConfiguration = &apimanagement.VirtualNetworkConfiguration{ - SubnetResourceID: &subnetResourceId, + additionalLocation.VirtualNetworkConfiguration = &apimanagementservice.VirtualNetworkConfiguration{ + SubnetResourceId: pointer.To(subnetResourceId), } } publicIPAddressID := config["public_ip_address_id"].(string) if publicIPAddressID != "" { - if sku.Name != apimanagement.SkuTypePremium { + if sku.Name != apimanagementservice.SkuTypePremium { if len(childVnetConfig) == 0 { return nil, fmt.Errorf("`public_ip_address_id` for an additional location is only supported when sku type is `Premium`, and the APIM instance is deployed in a virtual network.") } } - additionalLocation.PublicIPAddressID = &publicIPAddressID + additionalLocation.PublicIPAddressId = &publicIPAddressID } zones := zones.ExpandUntyped(d.Get("zones").(*schema.Set).List()) @@ -1514,127 +1470,54 @@ func expandAzureRmApiManagementAdditionalLocations(d *pluginsdk.ResourceData, sk return &additionalLocations, nil } -func flattenApiManagementAdditionalLocations(input *[]apimanagement.AdditionalLocation) ([]interface{}, error) { +func flattenApiManagementAdditionalLocations(input *[]apimanagementservice.AdditionalLocation) ([]interface{}, error) { results := make([]interface{}, 0) if input == nil { return results, nil } for _, prop := range *input { - var publicIPAddresses []string - if prop.PublicIPAddresses != nil { - publicIPAddresses = *prop.PublicIPAddresses - } - - publicIpAddressId := "" - if prop.PublicIPAddressID != nil { - publicIpAddressId = *prop.PublicIPAddressID - } - - var privateIPAddresses []string - if prop.PrivateIPAddresses != nil { - privateIPAddresses = *prop.PrivateIPAddresses - } - - var capacity *int32 - if prop.Sku.Capacity != nil { - capacity = prop.Sku.Capacity - } - - gatewayRegionalUrl := "" - if prop.GatewayRegionalURL != nil { - gatewayRegionalUrl = *prop.GatewayRegionalURL - } - - var gatewayDisabled bool - if prop.DisableGateway != nil { - gatewayDisabled = *prop.DisableGateway - } virtualNetworkConfiguration, err := flattenApiManagementVirtualNetworkConfiguration(prop.VirtualNetworkConfiguration) if err != nil { return results, err } + results = append(results, map[string]interface{}{ - "capacity": capacity, - "gateway_regional_url": gatewayRegionalUrl, - "location": location.NormalizeNilable(prop.Location), - "private_ip_addresses": privateIPAddresses, - "public_ip_address_id": publicIpAddressId, - "public_ip_addresses": publicIPAddresses, + "capacity": int32(prop.Sku.Capacity), + "gateway_regional_url": pointer.From(prop.GatewayRegionalUrl), + "location": location.NormalizeNilable(pointer.To(prop.Location)), + "private_ip_addresses": pointer.From(prop.PrivateIPAddresses), + "public_ip_address_id": pointer.From(prop.PublicIPAddressId), + "public_ip_addresses": pointer.From(prop.PublicIPAddresses), "virtual_network_configuration": virtualNetworkConfiguration, "zones": zones.FlattenUntyped(prop.Zones), - "gateway_disabled": gatewayDisabled, + "gateway_disabled": pointer.From(prop.DisableGateway), }) } return results, nil } -func expandIdentity(input []interface{}) (*apimanagement.ServiceIdentity, error) { - expanded, err := identity.ExpandSystemAndUserAssignedMap(input) - if err != nil { - return nil, err - } - - out := apimanagement.ServiceIdentity{ - Type: apimanagement.ApimIdentityType(string(expanded.Type)), - } - if expanded.Type == identity.TypeUserAssigned || expanded.Type == identity.TypeSystemAssignedUserAssigned { - out.UserAssignedIdentities = make(map[string]*apimanagement.UserIdentityProperties) - for k := range expanded.IdentityIds { - out.UserAssignedIdentities[k] = &apimanagement.UserIdentityProperties{ - // intentionally empty - } - } - } - return &out, nil -} - -func flattenIdentity(input *apimanagement.ServiceIdentity) (*[]interface{}, error) { - var transform *identity.SystemAndUserAssignedMap - - if input != nil { - transform = &identity.SystemAndUserAssignedMap{ - Type: identity.Type(string(input.Type)), - IdentityIds: make(map[string]identity.UserAssignedIdentityDetails), - } - if input.PrincipalID != nil { - transform.PrincipalId = input.PrincipalID.String() - } - if input.TenantID != nil { - transform.TenantId = input.TenantID.String() - } - for k, v := range input.UserAssignedIdentities { - transform.IdentityIds[k] = identity.UserAssignedIdentityDetails{ - ClientId: v.ClientID, - PrincipalId: v.PrincipalID, - } - } - } - - return identity.FlattenSystemAndUserAssignedMap(transform) -} - -func expandAzureRmApiManagementSkuName(input string) apimanagement.ServiceSkuProperties { +func expandAzureRmApiManagementSkuName(input string) apimanagementservice.ApiManagementServiceSkuProperties { // "sku_name" is validated to be in this format above, and is required skuParts := strings.Split(input, "_") name := skuParts[0] capacity, _ := strconv.Atoi(skuParts[1]) - return apimanagement.ServiceSkuProperties{ - Name: apimanagement.SkuType(name), - Capacity: pointer.To(int32(capacity)), + return apimanagementservice.ApiManagementServiceSkuProperties{ + Name: apimanagementservice.SkuType(name), + Capacity: int64(capacity), } } -func flattenApiManagementServiceSkuName(input *apimanagement.ServiceSkuProperties) string { +func flattenApiManagementServiceSkuName(input *apimanagementservice.ApiManagementServiceSkuProperties) string { if input == nil { return "" } - return fmt.Sprintf("%s_%d", string(input.Name), *input.Capacity) + return fmt.Sprintf("%s_%d", string(input.Name), input.Capacity) } -func expandApiManagementCustomProperties(d *pluginsdk.ResourceData, skuIsConsumption bool) (map[string]*string, error) { +func expandApiManagementCustomProperties(d *pluginsdk.ResourceData, skuIsConsumption bool) (map[string]string, error) { backendProtocolSsl3 := false backendProtocolTls10 := false backendProtocolTls11 := false @@ -1722,53 +1605,52 @@ func expandApiManagementCustomProperties(d *pluginsdk.ResourceData, skuIsConsump } } - customProperties := map[string]*string{ - apimBackendProtocolSsl3: utils.String(strconv.FormatBool(backendProtocolSsl3)), - apimBackendProtocolTls10: utils.String(strconv.FormatBool(backendProtocolTls10)), - apimBackendProtocolTls11: utils.String(strconv.FormatBool(backendProtocolTls11)), - apimFrontendProtocolTls10: utils.String(strconv.FormatBool(frontendProtocolTls10)), - apimFrontendProtocolTls11: utils.String(strconv.FormatBool(frontendProtocolTls11)), + customProperties := map[string]string{ + apimBackendProtocolSsl3: strconv.FormatBool(backendProtocolSsl3), + apimBackendProtocolTls10: strconv.FormatBool(backendProtocolTls10), + apimBackendProtocolTls11: strconv.FormatBool(backendProtocolTls11), + apimFrontendProtocolTls10: strconv.FormatBool(frontendProtocolTls10), + apimFrontendProtocolTls11: strconv.FormatBool(frontendProtocolTls11), } if !skuIsConsumption { - customProperties[apimFrontendProtocolSsl3] = utils.String(strconv.FormatBool(frontendProtocolSsl3)) - customProperties[apimTripleDesCiphers] = utils.String(strconv.FormatBool(tripleDesCiphers)) - customProperties[apimTlsEcdheEcdsaWithAes256CbcShaCiphers] = utils.String(strconv.FormatBool(tlsEcdheEcdsaWithAes256CbcShaCiphers)) - customProperties[apimTlsEcdheEcdsaWithAes128CbcShaCiphers] = utils.String(strconv.FormatBool(tlsEcdheEcdsaWithAes128CbcShaCiphers)) - customProperties[apimTlsEcdheRsaWithAes256CbcShaCiphers] = utils.String(strconv.FormatBool(tlsEcdheRsaWithAes256CbcShaCiphers)) - customProperties[apimTlsEcdheRsaWithAes128CbcShaCiphers] = utils.String(strconv.FormatBool(tlsEcdheRsaWithAes128CbcShaCiphers)) - customProperties[apimTlsRsaWithAes128GcmSha256Ciphers] = utils.String(strconv.FormatBool(tlsRsaWithAes128GcmSha256Ciphers)) - customProperties[apimTlsRsaWithAes256GcmSha384Ciphers] = utils.String(strconv.FormatBool(tlsRsaWithAes256GcmSha384Ciphers)) - customProperties[apimTlsRsaWithAes256CbcSha256Ciphers] = utils.String(strconv.FormatBool(tlsRsaWithAes256CbcSha256Ciphers)) - customProperties[apimTlsRsaWithAes128CbcSha256Ciphers] = utils.String(strconv.FormatBool(tlsRsaWithAes128CbcSha256Ciphers)) - customProperties[apimTlsRsaWithAes256CbcShaCiphers] = utils.String(strconv.FormatBool(tlsRsaWithAes256CbcShaCiphers)) - customProperties[apimTlsRsaWithAes128CbcShaCiphers] = utils.String(strconv.FormatBool(tlsRsaWithAes128CbcShaCiphers)) + customProperties[apimFrontendProtocolSsl3] = strconv.FormatBool(frontendProtocolSsl3) + customProperties[apimTripleDesCiphers] = strconv.FormatBool(tripleDesCiphers) + customProperties[apimTlsEcdheEcdsaWithAes256CbcShaCiphers] = strconv.FormatBool(tlsEcdheEcdsaWithAes256CbcShaCiphers) + customProperties[apimTlsEcdheEcdsaWithAes128CbcShaCiphers] = strconv.FormatBool(tlsEcdheEcdsaWithAes128CbcShaCiphers) + customProperties[apimTlsEcdheRsaWithAes256CbcShaCiphers] = strconv.FormatBool(tlsEcdheRsaWithAes256CbcShaCiphers) + customProperties[apimTlsEcdheRsaWithAes128CbcShaCiphers] = strconv.FormatBool(tlsEcdheRsaWithAes128CbcShaCiphers) + customProperties[apimTlsRsaWithAes128GcmSha256Ciphers] = strconv.FormatBool(tlsRsaWithAes128GcmSha256Ciphers) + customProperties[apimTlsRsaWithAes256GcmSha384Ciphers] = strconv.FormatBool(tlsRsaWithAes256GcmSha384Ciphers) + customProperties[apimTlsRsaWithAes256CbcSha256Ciphers] = strconv.FormatBool(tlsRsaWithAes256CbcSha256Ciphers) + customProperties[apimTlsRsaWithAes128CbcSha256Ciphers] = strconv.FormatBool(tlsRsaWithAes128CbcSha256Ciphers) + customProperties[apimTlsRsaWithAes256CbcShaCiphers] = strconv.FormatBool(tlsRsaWithAes256CbcShaCiphers) + customProperties[apimTlsRsaWithAes128CbcShaCiphers] = strconv.FormatBool(tlsRsaWithAes128CbcShaCiphers) } if vp := d.Get("protocols").([]interface{}); len(vp) > 0 { vpr := vp[0].(map[string]interface{}) enableHttp2 := vpr["enable_http2"].(bool) - customProperties[apimHttp2Protocol] = utils.String(strconv.FormatBool(enableHttp2)) + customProperties[apimHttp2Protocol] = strconv.FormatBool(enableHttp2) } return customProperties, nil } -func expandAzureRmApiManagementVirtualNetworkConfigurations(d *pluginsdk.ResourceData) *apimanagement.VirtualNetworkConfiguration { +func expandAzureRmApiManagementVirtualNetworkConfigurations(d *pluginsdk.ResourceData) *apimanagementservice.VirtualNetworkConfiguration { vs := d.Get("virtual_network_configuration").([]interface{}) if len(vs) == 0 { return nil } v := vs[0].(map[string]interface{}) - subnetResourceId := v["subnet_id"].(string) - return &apimanagement.VirtualNetworkConfiguration{ - SubnetResourceID: &subnetResourceId, + return &apimanagementservice.VirtualNetworkConfiguration{ + SubnetResourceId: pointer.To(v["subnet_id"].(string)), } } -func flattenApiManagementSecurityCustomProperties(input map[string]*string, skuIsConsumption bool) []interface{} { +func flattenApiManagementSecurityCustomProperties(input map[string]string, skuIsConsumption bool) []interface{} { output := make(map[string]interface{}) output["enable_backend_ssl30"] = parseApiManagementNilableDictionary(input, apimBackendProtocolSsl3) @@ -1795,7 +1677,7 @@ func flattenApiManagementSecurityCustomProperties(input map[string]*string, skuI return []interface{}{output} } -func flattenApiManagementProtocolsCustomProperties(input map[string]*string) []interface{} { +func flattenApiManagementProtocolsCustomProperties(input map[string]string) []interface{} { output := make(map[string]interface{}) output["enable_http2"] = parseApiManagementNilableDictionary(input, apimHttp2Protocol) @@ -1803,15 +1685,15 @@ func flattenApiManagementProtocolsCustomProperties(input map[string]*string) []i return []interface{}{output} } -func flattenApiManagementVirtualNetworkConfiguration(input *apimanagement.VirtualNetworkConfiguration) ([]interface{}, error) { +func flattenApiManagementVirtualNetworkConfiguration(input *apimanagementservice.VirtualNetworkConfiguration) ([]interface{}, error) { if input == nil { return []interface{}{}, nil } virtualNetworkConfiguration := make(map[string]interface{}) - if input.SubnetResourceID != nil { - subnetId, err := commonids.ParseSubnetIDInsensitively(*input.SubnetResourceID) + if input.SubnetResourceId != nil { + subnetId, err := commonids.ParseSubnetIDInsensitively(*input.SubnetResourceId) if err != nil { return []interface{}{}, err } @@ -1821,7 +1703,7 @@ func flattenApiManagementVirtualNetworkConfiguration(input *apimanagement.Virtua return []interface{}{virtualNetworkConfiguration}, nil } -func parseApiManagementNilableDictionary(input map[string]*string, key string) bool { +func parseApiManagementNilableDictionary(input map[string]string, key string) bool { log.Printf("Parsing value for %q", key) v, ok := input[key] @@ -1830,16 +1712,16 @@ func parseApiManagementNilableDictionary(input map[string]*string, key string) b return false } - val, err := strconv.ParseBool(*v) + val, err := strconv.ParseBool(v) if err != nil { - log.Printf(" parsing %q (key %q) as bool: %+v - assuming false", key, *v, err) + log.Printf(" parsing %q (key %q) as bool: %+v - assuming false", key, v, err) return false } return val } -func expandApiManagementSignInSettings(input []interface{}) apimanagement.PortalSigninSettings { +func expandApiManagementSignInSettings(input []interface{}) signinsettings.PortalSigninSettings { enabled := false if len(input) > 0 { @@ -1847,19 +1729,19 @@ func expandApiManagementSignInSettings(input []interface{}) apimanagement.Portal enabled = vs["enabled"].(bool) } - return apimanagement.PortalSigninSettings{ - PortalSigninSettingProperties: &apimanagement.PortalSigninSettingProperties{ - Enabled: utils.Bool(enabled), + return signinsettings.PortalSigninSettings{ + Properties: &signinsettings.PortalSigninSettingProperties{ + Enabled: pointer.To(enabled), }, } } -func flattenApiManagementSignInSettings(input apimanagement.PortalSigninSettings) []interface{} { +func flattenApiManagementSignInSettings(input signinsettings.PortalSigninSettings) []interface{} { enabled := false - if props := input.PortalSigninSettingProperties; props != nil { + if props := input.Properties; props != nil { if props.Enabled != nil { - enabled = *props.Enabled + enabled = pointer.From(props.Enabled) } } @@ -1870,66 +1752,58 @@ func flattenApiManagementSignInSettings(input apimanagement.PortalSigninSettings } } -func expandApiManagementDelegationSettings(input []interface{}) apimanagement.PortalDelegationSettings { +func expandApiManagementDelegationSettings(input []interface{}) delegationsettings.PortalDelegationSettings { if len(input) == 0 { - return apimanagement.PortalDelegationSettings{} + return delegationsettings.PortalDelegationSettings{} } vs := input[0].(map[string]interface{}) - props := apimanagement.PortalDelegationSettingsProperties{ - UserRegistration: &apimanagement.RegistrationDelegationSettingsProperties{ - Enabled: utils.Bool(vs["user_registration_enabled"].(bool)), + props := delegationsettings.PortalDelegationSettingsProperties{ + UserRegistration: &delegationsettings.RegistrationDelegationSettingsProperties{ + Enabled: pointer.To(vs["user_registration_enabled"].(bool)), }, - Subscriptions: &apimanagement.SubscriptionsDelegationSettingsProperties{ - Enabled: utils.Bool(vs["subscriptions_enabled"].(bool)), + Subscriptions: &delegationsettings.SubscriptionsDelegationSettingsProperties{ + Enabled: pointer.To(vs["subscriptions_enabled"].(bool)), }, } validationKey := vs["validation_key"].(string) if !vs["user_registration_enabled"].(bool) && !vs["subscriptions_enabled"].(bool) && validationKey == "" { // for some reason we cannot leave this empty - props.ValidationKey = utils.String("cGxhY2Vob2xkZXIxCg==") + props.ValidationKey = pointer.To("cGxhY2Vob2xkZXIxCg==") } if validationKey != "" { - props.ValidationKey = utils.String(validationKey) + props.ValidationKey = pointer.To(validationKey) } url := vs["url"].(string) if !vs["user_registration_enabled"].(bool) && !vs["subscriptions_enabled"].(bool) && url == "" { // for some reason we cannot leave this empty - props.URL = utils.String("https://www.placeholder.com") + props.Url = pointer.To("https://www.placeholder.com") } if url != "" { - props.URL = utils.String(url) + props.Url = pointer.To(url) } - return apimanagement.PortalDelegationSettings{ - PortalDelegationSettingsProperties: &props, + return delegationsettings.PortalDelegationSettings{ + Properties: &props, } } -func flattenApiManagementDelegationSettings(input apimanagement.PortalDelegationSettings, keyContract apimanagement.PortalSettingValidationKeyContract) []interface{} { +func flattenApiManagementDelegationSettings(input delegationsettings.PortalDelegationSettings, keyContract delegationsettings.PortalSettingValidationKeyContract) []interface{} { url := "" subscriptionsEnabled := false userRegistrationEnabled := false - if props := input.PortalDelegationSettingsProperties; props != nil { - if props.URL != nil { - url = *props.URL + if props := input.Properties; props != nil { + url = pointer.From(props.Url) + if props.Subscriptions != nil { + subscriptionsEnabled = pointer.From(props.Subscriptions.Enabled) } - - if props.Subscriptions != nil && props.Subscriptions.Enabled != nil { - subscriptionsEnabled = *props.Subscriptions.Enabled + if props.UserRegistration != nil { + userRegistrationEnabled = pointer.From(props.UserRegistration.Enabled) } - - if props.UserRegistration != nil && props.UserRegistration.Enabled != nil { - userRegistrationEnabled = *props.UserRegistration.Enabled - } - } - validationKey := "" - if keyContract.ValidationKey != nil { - validationKey = *keyContract.ValidationKey } return []interface{}{ @@ -1937,20 +1811,20 @@ func flattenApiManagementDelegationSettings(input apimanagement.PortalDelegation "url": url, "subscriptions_enabled": subscriptionsEnabled, "user_registration_enabled": userRegistrationEnabled, - "validation_key": validationKey, + "validation_key": pointer.From(keyContract.ValidationKey), }, } } -func expandApiManagementSignUpSettings(input []interface{}) apimanagement.PortalSignupSettings { +func expandApiManagementSignUpSettings(input []interface{}) signupsettings.PortalSignupSettings { if len(input) == 0 { - return apimanagement.PortalSignupSettings{ - PortalSignupSettingsProperties: &apimanagement.PortalSignupSettingsProperties{ - Enabled: utils.Bool(false), - TermsOfService: &apimanagement.TermsOfServiceProperties{ - ConsentRequired: utils.Bool(false), - Enabled: utils.Bool(false), - Text: utils.String(""), + return signupsettings.PortalSignupSettings{ + Properties: &signupsettings.PortalSignupSettingsProperties{ + Enabled: pointer.To(false), + TermsOfService: &signupsettings.TermsOfServiceProperties{ + ConsentRequired: pointer.To(false), + Enabled: pointer.To(false), + Text: pointer.To(""), }, }, } @@ -1958,48 +1832,38 @@ func expandApiManagementSignUpSettings(input []interface{}) apimanagement.Portal vs := input[0].(map[string]interface{}) - props := apimanagement.PortalSignupSettingsProperties{ - Enabled: utils.Bool(vs["enabled"].(bool)), + props := signupsettings.PortalSignupSettingsProperties{ + Enabled: pointer.To(vs["enabled"].(bool)), } termsOfServiceRaw := vs["terms_of_service"].([]interface{}) if len(termsOfServiceRaw) > 0 { termsOfServiceVs := termsOfServiceRaw[0].(map[string]interface{}) - props.TermsOfService = &apimanagement.TermsOfServiceProperties{ - Enabled: utils.Bool(termsOfServiceVs["enabled"].(bool)), - ConsentRequired: utils.Bool(termsOfServiceVs["consent_required"].(bool)), - Text: utils.String(termsOfServiceVs["text"].(string)), + props.TermsOfService = &signupsettings.TermsOfServiceProperties{ + Enabled: pointer.To(termsOfServiceVs["enabled"].(bool)), + ConsentRequired: pointer.To(termsOfServiceVs["consent_required"].(bool)), + Text: pointer.To(termsOfServiceVs["text"].(string)), } } - return apimanagement.PortalSignupSettings{ - PortalSignupSettingsProperties: &props, + return signupsettings.PortalSignupSettings{ + Properties: &props, } } -func flattenApiManagementSignUpSettings(input apimanagement.PortalSignupSettings) []interface{} { +func flattenApiManagementSignUpSettings(input signupsettings.PortalSignupSettings) []interface{} { enabled := false termsOfService := make([]interface{}, 0) - if props := input.PortalSignupSettingsProperties; props != nil { - if props.Enabled != nil { - enabled = *props.Enabled - } + if props := input.Properties; props != nil { + enabled = pointer.From(props.Enabled) if tos := props.TermsOfService; tos != nil { output := make(map[string]interface{}) - if tos.Enabled != nil { - output["enabled"] = *tos.Enabled - } - - if tos.ConsentRequired != nil { - output["consent_required"] = *tos.ConsentRequired - } - - if tos.Text != nil { - output["text"] = *tos.Text - } + output["enabled"] = pointer.From(tos.Enabled) + output["consent_required"] = pointer.From(tos.ConsentRequired) + output["text"] = pointer.From(tos.Text) termsOfService = append(termsOfService, output) } @@ -2013,7 +1877,7 @@ func flattenApiManagementSignUpSettings(input apimanagement.PortalSignupSettings } } -func expandApiManagementPolicies(input []interface{}) (*apimanagement.PolicyContract, error) { +func expandApiManagementPolicies(input []interface{}) (*policy.PolicyContract, error) { if len(input) == 0 || input[0] == nil { return nil, nil } @@ -2023,19 +1887,19 @@ func expandApiManagementPolicies(input []interface{}) (*apimanagement.PolicyCont xmlLink := vs["xml_link"].(string) if xmlContent != "" { - return &apimanagement.PolicyContract{ - PolicyContractProperties: &apimanagement.PolicyContractProperties{ - Format: apimanagement.PolicyContentFormatRawxml, - Value: utils.String(xmlContent), + return &policy.PolicyContract{ + Properties: &policy.PolicyContractProperties{ + Format: pointer.To(policy.PolicyContentFormatRawxml), + Value: xmlContent, }, }, nil } if xmlLink != "" { - return &apimanagement.PolicyContract{ - PolicyContractProperties: &apimanagement.PolicyContractProperties{ - Format: apimanagement.PolicyContentFormatXMLLink, - Value: utils.String(xmlLink), + return &policy.PolicyContract{ + Properties: &policy.PolicyContractProperties{ + Format: pointer.To(policy.PolicyContentFormatXmlNegativelink), + Value: xmlLink, }, }, nil } @@ -2043,11 +1907,11 @@ func expandApiManagementPolicies(input []interface{}) (*apimanagement.PolicyCont return nil, fmt.Errorf("Either `xml_content` or `xml_link` should be set if the `policy` block is defined.") } -func flattenApiManagementPolicies(d *pluginsdk.ResourceData, input apimanagement.PolicyContract) []interface{} { +func flattenApiManagementPolicies(d *pluginsdk.ResourceData, input *policy.PolicyContract) []interface{} { xmlContent := "" - if props := input.PolicyContractProperties; props != nil { - if props.Value != nil { - xmlContent = *props.Value + if input != nil && input.Properties != nil { + if input.Properties.Value != "" { + xmlContent = input.Properties.Value } } @@ -2074,7 +1938,7 @@ func flattenApiManagementPolicies(d *pluginsdk.ResourceData, input apimanagement return []interface{}{output} } -func expandApiManagementTenantAccessSettings(input []interface{}) apimanagement.AccessInformationUpdateParameters { +func expandApiManagementTenantAccessSettings(input []interface{}) tenantaccess.AccessInformationUpdateParameters { enabled := false if len(input) > 0 { @@ -2082,41 +1946,32 @@ func expandApiManagementTenantAccessSettings(input []interface{}) apimanagement. enabled = vs["enabled"].(bool) } - return apimanagement.AccessInformationUpdateParameters{ - AccessInformationUpdateParameterProperties: &apimanagement.AccessInformationUpdateParameterProperties{ - Enabled: utils.Bool(enabled), + return tenantaccess.AccessInformationUpdateParameters{ + Properties: &tenantaccess.AccessInformationUpdateParameterProperties{ + Enabled: pointer.To(enabled), }, } } -func flattenApiManagementTenantAccessSettings(input apimanagement.AccessInformationSecretsContract) []interface{} { +func flattenApiManagementTenantAccessSettings(input tenantaccess.AccessInformationSecretsContract) []interface{} { result := make(map[string]interface{}) - result["enabled"] = *input.Enabled - - if input.ID != nil { - result["tenant_id"] = *input.ID - } - - if input.PrimaryKey != nil { - result["primary_key"] = *input.PrimaryKey - } - - if input.SecondaryKey != nil { - result["secondary_key"] = *input.SecondaryKey - } + result["enabled"] = pointer.From(input.Enabled) + result["tenant_id"] = pointer.From(input.Id) + result["primary_key"] = pointer.From(input.PrimaryKey) + result["secondary_key"] = pointer.From(input.SecondaryKey) return []interface{}{result} } -func flattenAPIManagementCertificates(d *pluginsdk.ResourceData, inputs *[]apimanagement.CertificateConfiguration) []interface{} { +func flattenAPIManagementCertificates(d *pluginsdk.ResourceData, inputs *[]apimanagementservice.CertificateConfiguration) []interface{} { if inputs == nil || len(*inputs) == 0 { return []interface{}{} } outputs := []interface{}{} for i, input := range *inputs { - var expiry, subject, thumbprint, pwd, encodedCertificate string + var pwd, encodedCertificate string if v, ok := d.GetOk(fmt.Sprintf("certificate.%d.certificate_password", i)); ok { pwd = v.(string) } @@ -2125,25 +1980,13 @@ func flattenAPIManagementCertificates(d *pluginsdk.ResourceData, inputs *[]apima encodedCertificate = v.(string) } - if input.Certificate.Expiry != nil && !input.Certificate.Expiry.IsZero() { - expiry = input.Certificate.Expiry.Format(time.RFC3339) - } - - if input.Certificate.Thumbprint != nil { - thumbprint = *input.Certificate.Thumbprint - } - - if input.Certificate.Subject != nil { - subject = *input.Certificate.Subject - } - output := map[string]interface{}{ "certificate_password": pwd, "encoded_certificate": encodedCertificate, "store_name": string(input.StoreName), - "expiry": expiry, - "subject": subject, - "thumbprint": thumbprint, + "expiry": input.Certificate.Expiry, + "subject": input.Certificate.Subject, + "thumbprint": input.Certificate.Thumbprint, } outputs = append(outputs, output) } diff --git a/internal/services/apimanagement/api_management_resource_test.go b/internal/services/apimanagement/api_management_resource_test.go index e0a28db20387..97c549814028 100644 --- a/internal/services/apimanagement/api_management_resource_test.go +++ b/internal/services/apimanagement/api_management_resource_test.go @@ -9,13 +9,15 @@ import ( "regexp" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/testclient" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementResource struct{} @@ -600,19 +602,17 @@ func TestAccApiManagement_softDeleteRecoveryDisabled(t *testing.T) { } func (ApiManagementResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApiManagementID(state.ID) + id, err := apimanagementservice.ParseServiceID(state.ID) if err != nil { return nil, err } - resourceGroup := id.ResourceGroup - name := id.ServiceName - resp, err := clients.ApiManagement.ServiceClient.Get(ctx, resourceGroup, name) + resp, err := clients.ApiManagement.ServiceClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementResource) testCheckHasNoProductsOrApis(resourceName string) pluginsdk.TestCheckFunc { @@ -628,32 +628,31 @@ func (ApiManagementResource) testCheckHasNoProductsOrApis(resourceName string) p return fmt.Errorf("%q was not found in the state", resourceName) } - id, err := parse.ApiManagementID(rs.Primary.ID) + id, err := apimanagementservice.ParseServiceID(rs.Primary.ID) if err != nil { return err } - for apis, err := client.ApiManagement.ApiClient.ListByService(ctx, id.ResourceGroup, id.ServiceName, "", nil, nil, "", nil); apis.NotDone(); err = apis.NextWithContext(ctx) { - if err != nil { - return fmt.Errorf("listing APIs for %s: %+v", id, err) - } - if apis.Response().IsEmpty() { - break - } - if count := len(apis.Values()); count > 0 { - return fmt.Errorf("%s has %d unexpected associated APIs", id, count) - } + apiServiceId := api.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName) + listResp, err := client.ApiManagement.ApiClient.ListByService(ctx, apiServiceId, api.ListByServiceOperationOptions{}) + if err != nil { + return fmt.Errorf("listing APIs after creation of %s: %+v", *id, err) } - for products, err := client.ApiManagement.ProductsClient.ListByService(ctx, id.ResourceGroup, id.ServiceName, "", nil, nil, nil, ""); products.NotDone(); err = products.NextWithContext(ctx) { - if err != nil { - return fmt.Errorf("listing APIs for %s: %+v", id, err) - } - if products.Response().IsEmpty() { - break + if model := listResp.Model; model != nil { + if count := len(*model); count > 0 { + return fmt.Errorf("%s has %d unexpected associated APIs", *id, count) } - if count := len(products.Values()); count > 0 { - return fmt.Errorf("%s has %d unexpected associated Products", id, count) + } + + produceServiceId := product.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName) + proListResp, err := client.ApiManagement.ProductsClient.ListByService(ctx, produceServiceId, product.ListByServiceOperationOptions{}) + if err != nil { + return fmt.Errorf("listing products after creation of %s: %+v", *id, err) + } + if model := proListResp.Model; model != nil { + if count := len(*model); count > 0 { + return fmt.Errorf("%s has %d unexpected associated Products", *id, count) } } diff --git a/internal/services/apimanagement/api_management_subscription_resource.go b/internal/services/apimanagement/api_management_subscription_resource.go index 0be8c4bc5a99..9e4deb5e8314 100644 --- a/internal/services/apimanagement/api_management_subscription_resource.go +++ b/internal/services/apimanagement/api_management_subscription_resource.go @@ -10,20 +10,22 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck "github.com/Azure/go-autorest/autorest" "github.com/gofrs/uuid" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementSubscription() *pluginsdk.Resource { @@ -34,7 +36,7 @@ func resourceApiManagementSubscription() *pluginsdk.Resource { Delete: resourceApiManagementSubscriptionDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.SubscriptionID(id) + _, err := subscription.ParseSubscriptions2ID(id) return err }), @@ -76,7 +78,7 @@ func resourceApiManagementSubscription() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ForceNew: true, - ValidateFunc: validate.ProductID, + ValidateFunc: product.ValidateProductID, ConflictsWith: []string{"api_id"}, }, @@ -84,21 +86,21 @@ func resourceApiManagementSubscription() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ForceNew: true, - ValidateFunc: validate.ApiID, + ValidateFunc: api.ValidateApiID, ConflictsWith: []string{"product_id"}, }, "state": { Type: pluginsdk.TypeString, Optional: true, - Default: string(apimanagement.SubscriptionStateSubmitted), + Default: string(subscription.SubscriptionStateSubmitted), ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.SubscriptionStateActive), - string(apimanagement.SubscriptionStateCancelled), - string(apimanagement.SubscriptionStateExpired), - string(apimanagement.SubscriptionStateRejected), - string(apimanagement.SubscriptionStateSubmitted), - string(apimanagement.SubscriptionStateSuspended), + string(subscription.SubscriptionStateActive), + string(subscription.SubscriptionStateCancelled), + string(subscription.SubscriptionStateExpired), + string(subscription.SubscriptionStateRejected), + string(subscription.SubscriptionStateSubmitted), + string(subscription.SubscriptionStateSuspended), }, false), }, @@ -140,18 +142,18 @@ func resourceApiManagementSubscriptionCreateUpdate(d *pluginsdk.ResourceData, me subName = subId.String() } - id := parse.NewSubscriptionID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), subName) + id := subscription.NewSubscriptions2ID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), subName) if d.IsNewResource() { - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("checking for present of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(resp.Response) { - return tf.ImportAsExistsError("azurerm_api_management_subscription", *resp.ID) + if !response.WasNotFound(resp.HttpResponse) { + return tf.ImportAsExistsError("azurerm_api_management_subscription", id.ID()) } } @@ -171,30 +173,28 @@ func resourceApiManagementSubscriptionCreateUpdate(d *pluginsdk.ResourceData, me scope = "/apis" } - params := apimanagement.SubscriptionCreateParameters{ - SubscriptionCreateParameterProperties: &apimanagement.SubscriptionCreateParameterProperties{ - DisplayName: utils.String(displayName), - Scope: utils.String(scope), - State: apimanagement.SubscriptionState(state), - AllowTracing: utils.Bool(allowTracing), + params := subscription.SubscriptionCreateParameters{ + Properties: &subscription.SubscriptionCreateParameterProperties{ + DisplayName: displayName, + Scope: scope, + State: pointer.To(subscription.SubscriptionState(state)), + AllowTracing: pointer.To(allowTracing), }, } if v, ok := d.GetOk("user_id"); ok { - params.SubscriptionCreateParameterProperties.OwnerID = utils.String(v.(string)) + params.Properties.OwnerId = pointer.To(v.(string)) } if v, ok := d.GetOk("primary_key"); ok { - params.SubscriptionCreateParameterProperties.PrimaryKey = utils.String(v.(string)) + params.Properties.PrimaryKey = pointer.To(v.(string)) } if v, ok := d.GetOk("secondary_key"); ok { - params.SubscriptionCreateParameterProperties.SecondaryKey = utils.String(v.(string)) + params.Properties.SecondaryKey = pointer.To(v.(string)) } - sendEmail := utils.Bool(false) - err := pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.Name, params, sendEmail, "", apimanagement.AppTypeDeveloperPortal); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, params, subscription.CreateOrUpdateOperationOptions{AppType: pointer.To(subscription.AppTypeDeveloperPortal), Notify: pointer.To(false)}); err != nil { // APIM admins set limit on number of subscriptions to a product. In order to be able to correctly enforce that limit service cannot let simultaneous creations // to go through and first one wins/subsequent one gets 412 and that client/user can retry. This ensures that we have proper limits enforces as desired by APIM admin. if v, ok := err.(autorest.DetailedError); ok && v.StatusCode == http.StatusPreconditionFailed { @@ -218,58 +218,60 @@ func resourceApiManagementSubscriptionRead(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SubscriptionID(d.Id()) + id, err := subscription.ParseSubscriptions2ID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Subscription %q was not found in API Management Service %q / Resource Group %q - removing from state!", id.Name, id.ServiceName, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Subscription %q (API Management Service %q / Resource Group %q): %+v", id.Name, id.ServiceName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("subscription_id", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("subscription_id", id.SubscriptionName) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) - if props := resp.SubscriptionContractProperties; props != nil { - d.Set("display_name", props.DisplayName) - d.Set("state", string(props.State)) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("display_name", pointer.From(model.Properties.DisplayName)) + d.Set("state", string(model.Properties.State)) productId := "" apiId := "" // check if the subscription is for all apis or a specific product/ api - if props.Scope != nil && *props.Scope != "" && !strings.HasSuffix(*props.Scope, "/apis") { + if model.Properties.Scope != "" && !strings.HasSuffix(model.Properties.Scope, "/apis") { // the scope is either a product or api id - parseId, err := parse.ProductIDInsensitively(*props.Scope) + parseId, err := product.ParseProductIDInsensitively(model.Properties.Scope) if err == nil { productId = parseId.ID() } else { - parsedApiId, err := parse.ApiIDInsensitively(*props.Scope) + parsedApiId, err := api.ParseApiIDInsensitively(model.Properties.Scope) if err != nil { - return fmt.Errorf("parsing scope into product/ api id %q: %+v", *props.Scope, err) + return fmt.Errorf("parsing scope into product/ api id %q: %+v", model.Properties.Scope, err) } apiId = parsedApiId.ID() } } d.Set("product_id", productId) d.Set("api_id", apiId) - d.Set("user_id", props.OwnerID) - d.Set("allow_tracing", props.AllowTracing) + d.Set("user_id", pointer.From(model.Properties.OwnerId)) + d.Set("allow_tracing", pointer.From(model.Properties.AllowTracing)) } // Primary and secondary keys must be got from this additional api - keyResp, err := client.ListSecrets(ctx, id.ResourceGroup, id.ServiceName, id.Name) + keyResp, err := client.ListSecrets(ctx, *id) if err != nil { - return fmt.Errorf("listing Subscription %q Primary and Secondary Keys (API Management Service %q / Resource Group %q): %+v", id.Name, id.ServiceName, id.ResourceGroup, err) + return fmt.Errorf("listing Subscription %q Primary and Secondary Keys (API Management Service %q / Resource Group %q): %+v", id.SubscriptionId, id.ServiceName, id.ResourceGroupName, err) + } + if model := keyResp.Model; model != nil { + d.Set("primary_key", pointer.From(model.PrimaryKey)) + d.Set("secondary_key", pointer.From(model.SecondaryKey)) } - d.Set("primary_key", keyResp.PrimaryKey) - d.Set("secondary_key", keyResp.SecondaryKey) return nil } @@ -279,14 +281,14 @@ func resourceApiManagementSubscriptionDelete(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SubscriptionID(d.Id()) + id, err := subscription.ParseSubscriptions2ID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.Name, ""); err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("removing Subscription %q (API Management Service %q / Resource Group %q): %+v", id.Name, id.ServiceName, id.ResourceGroup, err) + if resp, err := client.Delete(ctx, *id, subscription.DeleteOperationOptions{}); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_subscription_resource_test.go b/internal/services/apimanagement/api_management_subscription_resource_test.go index 0ffd032752b0..f7e3cfb2ea8f 100644 --- a/internal/services/apimanagement/api_management_subscription_resource_test.go +++ b/internal/services/apimanagement/api_management_subscription_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementSubscriptionResource struct{} @@ -179,17 +179,17 @@ func TestAccApiManagementSubscription_allApis(t *testing.T) { } func (ApiManagementSubscriptionResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.SubscriptionID(state.ID) + id, err := subscription.ParseSubscriptions2ID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.SubscriptionsClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := clients.ApiManagement.SubscriptionsClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading ApiManagement Subscription (%s): %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementSubscriptionResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_tag_resource.go b/internal/services/apimanagement/api_management_tag_resource.go index bc849cfc7109..71452d6acfad 100644 --- a/internal/services/apimanagement/api_management_tag_resource.go +++ b/internal/services/apimanagement/api_management_tag_resource.go @@ -8,15 +8,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementTag() *pluginsdk.Resource { @@ -27,7 +27,7 @@ func resourceApiManagementTag() *pluginsdk.Resource { Delete: resourceApiManagementTagDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.TagID(id) + _, err := tag.ParseTagID(id) return err }), @@ -43,7 +43,7 @@ func resourceApiManagementTag() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ApiManagementID, + ValidateFunc: apimanagementservice.ValidateServiceID, }, "name": { @@ -69,22 +69,22 @@ func resourceApiManagementTagCreateUpdate(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - apiManagementId, err := parse.ApiManagementID(d.Get("api_management_id").(string)) + apiManagementId, err := apimanagementservice.ParseServiceID(d.Get("api_management_id").(string)) if err != nil { return err } - id := parse.NewTagID(subscriptionId, apiManagementId.ResourceGroup, apiManagementId.ServiceName, d.Get("name").(string)) + id := tag.NewTagID(subscriptionId, apiManagementId.ResourceGroupName, apiManagementId.ServiceName, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_tag", id.ID()) } } @@ -94,13 +94,13 @@ func resourceApiManagementTagCreateUpdate(d *pluginsdk.ResourceData, meta interf displayName = v.(string) } - parameters := apimanagement.TagCreateUpdateParameters{ - TagContractProperties: &apimanagement.TagContractProperties{ - DisplayName: &displayName, + parameters := tag.TagCreateUpdateParameters{ + Properties: &tag.TagContractProperties{ + DisplayName: displayName, }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.Name, parameters, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, tag.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -114,14 +114,14 @@ func resourceApiManagementTagRead(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.TagID(d.Id()) + id, err := tag.ParseTagID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", id) d.SetId("") return nil @@ -130,11 +130,11 @@ func resourceApiManagementTagRead(d *pluginsdk.ResourceData, meta interface{}) e return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("api_management_id", parse.NewApiManagementID(id.SubscriptionId, id.ResourceGroup, id.ServiceName).ID()) - d.Set("name", id.Name) + d.Set("api_management_id", apimanagementservice.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName).ID()) + d.Set("name", id.TagId) - if props := resp.TagContractProperties; props != nil { - d.Set("display_name", props.DisplayName) + if model := resp.Model; model != nil { + d.Set("display_name", model.Properties.DisplayName) } return nil @@ -145,12 +145,12 @@ func resourceApiManagementTagDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.TagID(d.Id()) + id, err := tag.ParseTagID(d.Id()) if err != nil { return err } - if _, err = client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.Name, ""); err != nil { + if _, err = client.Delete(ctx, *id, tag.DeleteOperationOptions{}); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } diff --git a/internal/services/apimanagement/api_management_tag_resource_test.go b/internal/services/apimanagement/api_management_tag_resource_test.go index 7de80651b8c5..0f8d70f1ebd2 100644 --- a/internal/services/apimanagement/api_management_tag_resource_test.go +++ b/internal/services/apimanagement/api_management_tag_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementTagResource struct{} @@ -78,17 +78,17 @@ func TestAccApiManagementTag_update(t *testing.T) { } func (ApiManagementTagResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.TagID(state.ID) + id, err := tag.ParseTagID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.TagClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := clients.ApiManagement.TagClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %q: %+v", id, err) + return nil, fmt.Errorf("retrieving %q: %+v", id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (r ApiManagementTagResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/api_management_user_data_source.go b/internal/services/apimanagement/api_management_user_data_source.go index 308f5b576586..7a9225f97315 100644 --- a/internal/services/apimanagement/api_management_user_data_source.go +++ b/internal/services/apimanagement/api_management_user_data_source.go @@ -7,13 +7,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceApiManagementUser() *pluginsdk.Resource { @@ -65,11 +66,11 @@ func dataSourceApiManagementUserRead(d *pluginsdk.ResourceData, meta interface{} ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewUserID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("user_id").(string)) + id := user.NewUserID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("user_id").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } @@ -78,12 +79,12 @@ func dataSourceApiManagementUserRead(d *pluginsdk.ResourceData, meta interface{} d.SetId(id.ID()) - if props := resp.UserContractProperties; props != nil { - d.Set("first_name", props.FirstName) - d.Set("last_name", props.LastName) - d.Set("email", props.Email) - d.Set("note", props.Note) - d.Set("state", string(props.State)) + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("first_name", pointer.From(model.Properties.FirstName)) + d.Set("last_name", pointer.From(model.Properties.LastName)) + d.Set("email", pointer.From(model.Properties.Email)) + d.Set("note", pointer.From(model.Properties.Note)) + d.Set("state", string(pointer.From(model.Properties.State))) } return nil diff --git a/internal/services/apimanagement/api_management_user_resource.go b/internal/services/apimanagement/api_management_user_resource.go index ff6b0d267d9d..01eadb977e8e 100644 --- a/internal/services/apimanagement/api_management_user_resource.go +++ b/internal/services/apimanagement/api_management_user_resource.go @@ -8,16 +8,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApiManagementUser() *pluginsdk.Resource { @@ -27,7 +27,7 @@ func resourceApiManagementUser() *pluginsdk.Resource { Update: resourceApiManagementUserCreateUpdate, Delete: resourceApiManagementUserDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.UserID(id) + _, err := user.ParseUserID(id) return err }), @@ -68,8 +68,8 @@ func resourceApiManagementUser() *pluginsdk.Resource { Optional: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.ConfirmationInvite), - string(apimanagement.ConfirmationSignup), + string(user.ConfirmationInvite), + string(user.ConfirmationSignup), }, false), }, @@ -89,9 +89,9 @@ func resourceApiManagementUser() *pluginsdk.Resource { Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{ - string(apimanagement.UserStateActive), - string(apimanagement.UserStateBlocked), - string(apimanagement.UserStatePending), + string(user.UserStateActive), + string(user.UserStateBlocked), + string(user.UserStatePending), }, false), }, }, @@ -106,7 +106,7 @@ func resourceApiManagementUserCreateUpdate(d *pluginsdk.ResourceData, meta inter log.Printf("[INFO] preparing arguments for API Management User creation.") - id := parse.NewUserID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("user_id").(string)) + id := user.NewUserID(subscriptionId, d.Get("resource_group_name").(string), d.Get("api_management_name").(string), d.Get("user_id").(string)) firstName := d.Get("first_name").(string) lastName := d.Get("last_name").(string) @@ -116,42 +116,41 @@ func resourceApiManagementUserCreateUpdate(d *pluginsdk.ResourceData, meta inter password := d.Get("password").(string) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_api_management_user", id.ID()) } } - properties := apimanagement.UserCreateParameters{ - UserCreateParameterProperties: &apimanagement.UserCreateParameterProperties{ - FirstName: utils.String(firstName), - LastName: utils.String(lastName), - Email: utils.String(email), + properties := user.UserCreateParameters{ + Properties: &user.UserCreateParameterProperties{ + FirstName: firstName, + LastName: lastName, + Email: email, }, } confirmation := d.Get("confirmation").(string) if confirmation != "" { - properties.UserCreateParameterProperties.Confirmation = apimanagement.Confirmation(confirmation) + properties.Properties.Confirmation = pointer.To(user.Confirmation(confirmation)) } if note != "" { - properties.UserCreateParameterProperties.Note = utils.String(note) + properties.Properties.Note = pointer.To(note) } if password != "" { - properties.UserCreateParameterProperties.Password = utils.String(password) + properties.Properties.Password = pointer.To(password) } if state != "" { - properties.UserCreateParameterProperties.State = apimanagement.UserState(state) + properties.Properties.State = pointer.To(user.UserState(state)) } - notify := utils.Bool(false) - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, id.Name, properties, notify, ""); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, properties, user.CreateOrUpdateOperationOptions{Notify: pointer.To(false)}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -165,32 +164,32 @@ func resourceApiManagementUserRead(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.UserID(d.Id()) + id, err := user.ParseUserID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("%s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("making Read request on %s: %+v", *id, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("user_id", id.Name) + d.Set("user_id", id.UserId) d.Set("api_management_name", id.ServiceName) - d.Set("resource_group_name", id.ResourceGroup) - - if props := resp.UserContractProperties; props != nil { - d.Set("first_name", props.FirstName) - d.Set("last_name", props.LastName) - d.Set("email", props.Email) - d.Set("note", props.Note) - d.Set("state", string(props.State)) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil && model.Properties != nil { + d.Set("first_name", pointer.From(model.Properties.FirstName)) + d.Set("last_name", pointer.From(model.Properties.LastName)) + d.Set("email", pointer.From(model.Properties.Email)) + d.Set("note", pointer.From(model.Properties.Note)) + d.Set("state", string(pointer.From(model.Properties.State))) } return nil @@ -201,17 +200,15 @@ func resourceApiManagementUserDelete(d *pluginsdk.ResourceData, meta interface{} ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.UserID(d.Id()) + id, err := user.ParseUserID(d.Id()) if err != nil { return err } log.Printf("[DEBUG] Deleting %s", *id) - deleteSubscriptions := utils.Bool(true) - notify := utils.Bool(false) - resp, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.Name, "", deleteSubscriptions, notify, apimanagement.AppTypeDeveloperPortal) + resp, err := client.Delete(ctx, *id, user.DeleteOperationOptions{AppType: pointer.To(user.AppTypeDeveloperPortal), DeleteSubscriptions: pointer.To(true), Notify: pointer.To(false)}) if err != nil { - if !utils.ResponseWasNotFound(resp) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/internal/services/apimanagement/api_management_user_resource_test.go b/internal/services/apimanagement/api_management_user_resource_test.go index 372826cbd909..5e67b031c104 100644 --- a/internal/services/apimanagement/api_management_user_resource_test.go +++ b/internal/services/apimanagement/api_management_user_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type ApiManagementUserResource struct{} @@ -180,17 +180,17 @@ func TestAccApiManagementUser_complete(t *testing.T) { } func (ApiManagementUserResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.UserID(state.ID) + id, err := user.ParseUserID(state.ID) if err != nil { return nil, err } - resp, err := clients.ApiManagement.UsersClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := clients.ApiManagement.UsersClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading %s: %+v", *id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return pointer.To(resp.Model != nil && resp.Model.Id != nil), nil } func (ApiManagementUserResource) basic(data acceptance.TestData) string { diff --git a/internal/services/apimanagement/client/client.go b/internal/services/apimanagement/client/client.go index 0cbb2d79875b..0942e75e0041 100644 --- a/internal/services/apimanagement/client/client.go +++ b/internal/services/apimanagement/client/client.go @@ -6,119 +6,248 @@ package client import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag" "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/schema" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - ApiClient *apimanagement.APIClient - ApiDiagnosticClient *apimanagement.APIDiagnosticClient - ApiOperationPoliciesClient *apimanagement.APIOperationPolicyClient - ApiOperationsClient *apimanagement.APIOperationClient - ApiPoliciesClient *apimanagement.APIPolicyClient - ApiReleasesClient *apimanagement.APIReleaseClient - ApiSchemasClient *apimanagement.APISchemaClient - ApiTagDescriptionClient *apimanagement.APITagDescriptionClient - ApiVersionSetClient *apimanagement.APIVersionSetClient - AuthorizationServersClient *apimanagement.AuthorizationServerClient - BackendClient *apimanagement.BackendClient - CacheClient *apimanagement.CacheClient - CertificatesClient *apimanagement.CertificateClient - DelegationSettingsClient *apimanagement.DelegationSettingsClient - DeletedServicesClient *apimanagement.DeletedServicesClient - DiagnosticClient *apimanagement.DiagnosticClient - EmailTemplateClient *apimanagement.EmailTemplateClient - GatewayApisClient *apimanagement.GatewayAPIClient - GatewayCertificateAuthorityClient *apimanagement.GatewayCertificateAuthorityClient - GatewayClient *apimanagement.GatewayClient - GatewayHostNameConfigurationClient *apimanagement.GatewayHostnameConfigurationClient + ApiClient *api.ApiClient + ApiDiagnosticClient *apidiagnostic.ApiDiagnosticClient + ApiOperationPoliciesClient *apioperationpolicy.ApiOperationPolicyClient + ApiOperationsClient *apioperation.ApiOperationClient + ApiOperationTagClient *apioperationtag.ApiOperationTagClient + ApiPoliciesClient *apipolicy.ApiPolicyClient + ApiReleasesClient *apirelease.ApiReleaseClient + ApiSchemasClient *apischema.ApiSchemaClient + ApiTagClient *apitag.ApiTagClient + ApiTagDescriptionClient *apitagdescription.ApiTagDescriptionClient + ApiVersionSetClient *apiversionset.ApiVersionSetClient + ApiVersionSetsClient *apiversionsets.ApiVersionSetsClient + AuthorizationServersClient *authorizationserver.AuthorizationServerClient + BackendClient *backend.BackendClient + CacheClient *cache.CacheClient + CertificatesClient *certificate.CertificateClient + DelegationSettingsClient *delegationsettings.DelegationSettingsClient + DeletedServicesClient *deletedservice.DeletedServiceClient + DiagnosticClient *diagnostic.DiagnosticClient + EmailTemplatesClient *emailtemplates.EmailTemplatesClient + GatewayApisClient *gatewayapi.GatewayApiClient + GatewayCertificateAuthorityClient *gatewaycertificateauthority.GatewayCertificateAuthorityClient + GatewayClient *gateway.GatewayClient + GatewayHostNameConfigurationClient *gatewayhostnameconfiguration.GatewayHostnameConfigurationClient GlobalSchemaClient *schema.SchemaClient - GroupClient *apimanagement.GroupClient - GroupUsersClient *apimanagement.GroupUserClient - IdentityProviderClient *apimanagement.IdentityProviderClient - LoggerClient *apimanagement.LoggerClient - NamedValueClient *apimanagement.NamedValueClient - NotificationRecipientEmailClient *apimanagement.NotificationRecipientEmailClient - NotificationRecipientUserClient *apimanagement.NotificationRecipientUserClient - OpenIdConnectClient *apimanagement.OpenIDConnectProviderClient - PolicyClient *apimanagement.PolicyClient - ProductApisClient *apimanagement.ProductAPIClient - ProductGroupsClient *apimanagement.ProductGroupClient - ProductPoliciesClient *apimanagement.ProductPolicyClient - ProductsClient *apimanagement.ProductClient - ServiceClient *apimanagement.ServiceClient - SignInClient *apimanagement.SignInSettingsClient - SignUpClient *apimanagement.SignUpSettingsClient - SubscriptionsClient *apimanagement.SubscriptionClient - TagClient *apimanagement.TagClient - TenantAccessClient *apimanagement.TenantAccessClient - UsersClient *apimanagement.UserClient + GroupClient *group.GroupClient + GroupUsersClient *groupuser.GroupUserClient + IdentityProviderClient *identityprovider.IdentityProviderClient + LoggerClient *logger.LoggerClient + NamedValueClient *namedvalue.NamedValueClient + NotificationRecipientEmailClient *notificationrecipientemail.NotificationRecipientEmailClient + NotificationRecipientUserClient *notificationrecipientuser.NotificationRecipientUserClient + OpenIdConnectClient *openidconnectprovider.OpenidConnectProviderClient + PolicyClient *policy.PolicyClient + ProductApisClient *productapi.ProductApiClient + ProductGroupsClient *productgroup.ProductGroupClient + ProductPoliciesClient *productpolicy.ProductPolicyClient + ProductsClient *product.ProductClient + ProductTagClient *producttag.ProductTagClient + ServiceClient *apimanagementservice.ApiManagementServiceClient + SignInClient *signinsettings.SignInSettingsClient + SignUpClient *signupsettings.SignUpSettingsClient + SubscriptionsClient *subscription.SubscriptionClient + TagClient *tag.TagClient + TenantAccessClient *tenantaccess.TenantAccessClient + UsersClient *user.UserClient } func NewClient(o *common.ClientOptions) (*Client, error) { - apiClient := apimanagement.NewAPIClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&apiClient.Client, o.ResourceManagerAuthorizer) + apiClient, err := api.NewApiClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Api client: %+v", err) + } + o.Configure(apiClient.Client, o.Authorizers.ResourceManager) - apiDiagnosticClient := apimanagement.NewAPIDiagnosticClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&apiDiagnosticClient.Client, o.ResourceManagerAuthorizer) + apiDiagnosticClient, err := apidiagnostic.NewApiDiagnosticClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Api Diagnostic client: %+v", err) + } + o.Configure(apiDiagnosticClient.Client, o.Authorizers.ResourceManager) - apiPoliciesClient := apimanagement.NewAPIPolicyClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&apiPoliciesClient.Client, o.ResourceManagerAuthorizer) + apiPoliciesClient, err := apipolicy.NewApiPolicyClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Api Policies client: %+v", err) + } + o.Configure(apiPoliciesClient.Client, o.Authorizers.ResourceManager) - apiOperationsClient := apimanagement.NewAPIOperationClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&apiOperationsClient.Client, o.ResourceManagerAuthorizer) + apiOperationsClient, err := apioperation.NewApiOperationClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Api Operations client: %+v", err) + } + o.Configure(apiOperationsClient.Client, o.Authorizers.ResourceManager) - apiOperationPoliciesClient := apimanagement.NewAPIOperationPolicyClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&apiOperationPoliciesClient.Client, o.ResourceManagerAuthorizer) + apiOperationTagClient, err := apioperationtag.NewApiOperationTagClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Api Operation Tag client: %+v", err) + } + o.Configure(apiOperationTagClient.Client, o.Authorizers.ResourceManager) - apiReleasesClient := apimanagement.NewAPIReleaseClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&apiReleasesClient.Client, o.ResourceManagerAuthorizer) + apiOperationPoliciesClient, err := apioperationpolicy.NewApiOperationPolicyClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Api Operation Policies client: %+v", err) + } + o.Configure(apiOperationPoliciesClient.Client, o.Authorizers.ResourceManager) - apiSchemasClient := apimanagement.NewAPISchemaClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&apiSchemasClient.Client, o.ResourceManagerAuthorizer) + apiReleasesClient, err := apirelease.NewApiReleaseClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Api Releases client: %+v", err) + } + o.Configure(apiReleasesClient.Client, o.Authorizers.ResourceManager) - apiVersionSetClient := apimanagement.NewAPIVersionSetClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&apiVersionSetClient.Client, o.ResourceManagerAuthorizer) + apiSchemasClient, err := apischema.NewApiSchemaClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Api Schemas client: %+v", err) + } + o.Configure(apiSchemasClient.Client, o.Authorizers.ResourceManager) - apiTagDescriptionClient := apimanagement.NewAPITagDescriptionClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&apiTagDescriptionClient.Client, o.ResourceManagerAuthorizer) + apiTagClient, err := apitag.NewApiTagClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Api Tag client: %+v", err) + } + o.Configure(apiTagClient.Client, o.Authorizers.ResourceManager) - authorizationServersClient := apimanagement.NewAuthorizationServerClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&authorizationServersClient.Client, o.ResourceManagerAuthorizer) + apiVersionSetClient, err := apiversionset.NewApiVersionSetClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Api Version Set client: %+v", err) + } + o.Configure(apiVersionSetClient.Client, o.Authorizers.ResourceManager) - backendClient := apimanagement.NewBackendClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&backendClient.Client, o.ResourceManagerAuthorizer) + apiVersionSetsClient, err := apiversionsets.NewApiVersionSetsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Api Version Sets client: %+v", err) + } + o.Configure(apiVersionSetsClient.Client, o.Authorizers.ResourceManager) - cacheClient := apimanagement.NewCacheClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&cacheClient.Client, o.ResourceManagerAuthorizer) + apiTagDescriptionClient, err := apitagdescription.NewApiTagDescriptionClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Api Tag Description client: %+v", err) + } + o.Configure(apiTagDescriptionClient.Client, o.Authorizers.ResourceManager) - certificatesClient := apimanagement.NewCertificateClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&certificatesClient.Client, o.ResourceManagerAuthorizer) + authorizationServersClient, err := authorizationserver.NewAuthorizationServerClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Authorization Servers client: %+v", err) + } + o.Configure(authorizationServersClient.Client, o.Authorizers.ResourceManager) - diagnosticClient := apimanagement.NewDiagnosticClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&diagnosticClient.Client, o.ResourceManagerAuthorizer) + backendClient, err := backend.NewBackendClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building backend client: %+v", err) + } + o.Configure(backendClient.Client, o.Authorizers.ResourceManager) - delegationSettingsClient := apimanagement.NewDelegationSettingsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&delegationSettingsClient.Client, o.ResourceManagerAuthorizer) + cacheClient, err := cache.NewCacheClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building cache client: %+v", err) + } + o.Configure(cacheClient.Client, o.Authorizers.ResourceManager) - deletedServicesClient := apimanagement.NewDeletedServicesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&deletedServicesClient.Client, o.ResourceManagerAuthorizer) + certificatesClient, err := certificate.NewCertificateClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building certificates client: %+v", err) + } + o.Configure(certificatesClient.Client, o.Authorizers.ResourceManager) - emailTemplateClient := apimanagement.NewEmailTemplateClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&emailTemplateClient.Client, o.ResourceManagerAuthorizer) + diagnosticClient, err := diagnostic.NewDiagnosticClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building diagnostic client: %+v", err) + } + o.Configure(diagnosticClient.Client, o.Authorizers.ResourceManager) - gatewayClient := apimanagement.NewGatewayClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&gatewayClient.Client, o.ResourceManagerAuthorizer) + delegationSettingsClient, err := delegationsettings.NewDelegationSettingsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Delegation Settings client: %+v", err) + } + o.Configure(delegationSettingsClient.Client, o.Authorizers.ResourceManager) - gatewayCertificateAuthorityClient := apimanagement.NewGatewayCertificateAuthorityClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&gatewayCertificateAuthorityClient.Client, o.ResourceManagerAuthorizer) + deletedServicesClient, err := deletedservice.NewDeletedServiceClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Deleted Services client: %+v", err) + } + o.Configure(deletedServicesClient.Client, o.Authorizers.ResourceManager) + + emailTemplatesClient, err := emailtemplates.NewEmailTemplatesClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Email Templates client: %+v", err) + } + o.Configure(emailTemplatesClient.Client, o.Authorizers.ResourceManager) + + gatewayClient, err := gateway.NewGatewayClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Gateway client: %+v", err) + } + o.Configure(gatewayClient.Client, o.Authorizers.ResourceManager) + + gatewayCertificateAuthorityClient, err := gatewaycertificateauthority.NewGatewayCertificateAuthorityClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Gateway Certificate Authority client: %+v", err) + } + o.Configure(gatewayCertificateAuthorityClient.Client, o.Authorizers.ResourceManager) - gatewayApisClient := apimanagement.NewGatewayAPIClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&gatewayApisClient.Client, o.ResourceManagerAuthorizer) + gatewayApisClient, err := gatewayapi.NewGatewayApiClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Gateway Apis client: %+v", err) + } + o.Configure(gatewayApisClient.Client, o.Authorizers.ResourceManager) - gatewayHostnameConfigurationClient := apimanagement.NewGatewayHostnameConfigurationClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&gatewayHostnameConfigurationClient.Client, o.ResourceManagerAuthorizer) + gatewayHostnameConfigurationClient, err := gatewayhostnameconfiguration.NewGatewayHostnameConfigurationClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Gateway Hostname Configuration client: %+v", err) + } + o.Configure(gatewayHostnameConfigurationClient.Client, o.Authorizers.ResourceManager) globalSchemaClient, err := schema.NewSchemaClientWithBaseURI(o.Environment.ResourceManager) if err != nil { @@ -126,108 +255,178 @@ func NewClient(o *common.ClientOptions) (*Client, error) { } o.Configure(globalSchemaClient.Client, o.Authorizers.ResourceManager) - groupClient := apimanagement.NewGroupClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&groupClient.Client, o.ResourceManagerAuthorizer) + groupClient, err := group.NewGroupClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Group client: %+v", err) + } + o.Configure(groupClient.Client, o.Authorizers.ResourceManager) - groupUsersClient := apimanagement.NewGroupUserClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&groupUsersClient.Client, o.ResourceManagerAuthorizer) + groupUsersClient, err := groupuser.NewGroupUserClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Group Users client: %+v", err) + } + o.Configure(groupUsersClient.Client, o.Authorizers.ResourceManager) - identityProviderClient := apimanagement.NewIdentityProviderClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&identityProviderClient.Client, o.ResourceManagerAuthorizer) + identityProviderClient, err := identityprovider.NewIdentityProviderClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Identity Provider client: %+v", err) + } + o.Configure(identityProviderClient.Client, o.Authorizers.ResourceManager) - namedValueClient := apimanagement.NewNamedValueClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&namedValueClient.Client, o.ResourceManagerAuthorizer) + namedValueClient, err := namedvalue.NewNamedValueClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Named Value client: %+v", err) + } + o.Configure(namedValueClient.Client, o.Authorizers.ResourceManager) - notificationRecipientEmailClient := apimanagement.NewNotificationRecipientEmailClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(¬ificationRecipientEmailClient.Client, o.ResourceManagerAuthorizer) + notificationRecipientEmailClient, err := notificationrecipientemail.NewNotificationRecipientEmailClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Notification Recipient Email client: %+v", err) + } + o.Configure(notificationRecipientEmailClient.Client, o.Authorizers.ResourceManager) - notificationRecipientUserClient := apimanagement.NewNotificationRecipientUserClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(¬ificationRecipientUserClient.Client, o.ResourceManagerAuthorizer) + notificationRecipientUserClient, err := notificationrecipientuser.NewNotificationRecipientUserClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Notification Recipient User client: %+v", err) + } + o.Configure(notificationRecipientUserClient.Client, o.Authorizers.ResourceManager) - loggerClient := apimanagement.NewLoggerClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&loggerClient.Client, o.ResourceManagerAuthorizer) + loggerClient, err := logger.NewLoggerClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Logger client: %+v", err) + } + o.Configure(loggerClient.Client, o.Authorizers.ResourceManager) - openIdConnectClient := apimanagement.NewOpenIDConnectProviderClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&openIdConnectClient.Client, o.ResourceManagerAuthorizer) + openIdConnectClient, err := openidconnectprovider.NewOpenidConnectProviderClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building OpenId Connect client: %+v", err) + } + o.Configure(openIdConnectClient.Client, o.Authorizers.ResourceManager) - policyClient := apimanagement.NewPolicyClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&policyClient.Client, o.ResourceManagerAuthorizer) + policyClient, err := policy.NewPolicyClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Policy client: %+v", err) + } + o.Configure(policyClient.Client, o.Authorizers.ResourceManager) - productsClient := apimanagement.NewProductClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&productsClient.Client, o.ResourceManagerAuthorizer) + productsClient, err := product.NewProductClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Products client: %+v", err) + } + o.Configure(productsClient.Client, o.Authorizers.ResourceManager) - productApisClient := apimanagement.NewProductAPIClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&productApisClient.Client, o.ResourceManagerAuthorizer) + productTagClient, err := producttag.NewProductTagClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Product Tag client: %+v", err) + } + o.Configure(productTagClient.Client, o.Authorizers.ResourceManager) - productGroupsClient := apimanagement.NewProductGroupClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&productGroupsClient.Client, o.ResourceManagerAuthorizer) + productApisClient, err := productapi.NewProductApiClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Product Apis client: %+v", err) + } + o.Configure(productApisClient.Client, o.Authorizers.ResourceManager) - productPoliciesClient := apimanagement.NewProductPolicyClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&productPoliciesClient.Client, o.ResourceManagerAuthorizer) + productGroupsClient, err := productgroup.NewProductGroupClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Product Groups client: %+v", err) + } + o.Configure(productGroupsClient.Client, o.Authorizers.ResourceManager) - serviceClient := apimanagement.NewServiceClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&serviceClient.Client, o.ResourceManagerAuthorizer) + productPoliciesClient, err := productpolicy.NewProductPolicyClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Product Policies client: %+v", err) + } + o.Configure(productPoliciesClient.Client, o.Authorizers.ResourceManager) - signInClient := apimanagement.NewSignInSettingsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&signInClient.Client, o.ResourceManagerAuthorizer) + serviceClient, err := apimanagementservice.NewApiManagementServiceClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Service client: %+v", err) + } + o.Configure(serviceClient.Client, o.Authorizers.ResourceManager) - signUpClient := apimanagement.NewSignUpSettingsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&signUpClient.Client, o.ResourceManagerAuthorizer) + signInClient, err := signinsettings.NewSignInSettingsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building SignIn client: %+v", err) + } + o.Configure(signInClient.Client, o.Authorizers.ResourceManager) - subscriptionsClient := apimanagement.NewSubscriptionClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&subscriptionsClient.Client, o.ResourceManagerAuthorizer) + signUpClient, err := signupsettings.NewSignUpSettingsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building SignUp client: %+v", err) + } + o.Configure(signUpClient.Client, o.Authorizers.ResourceManager) - tagClient := apimanagement.NewTagClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&tagClient.Client, o.ResourceManagerAuthorizer) + subscriptionsClient, err := subscription.NewSubscriptionClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Subscriptions client: %+v", err) + } + o.Configure(subscriptionsClient.Client, o.Authorizers.ResourceManager) - tenantAccessClient := apimanagement.NewTenantAccessClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&tenantAccessClient.Client, o.ResourceManagerAuthorizer) + tagClient, err := tag.NewTagClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building tag client: %+v", err) + } + o.Configure(tagClient.Client, o.Authorizers.ResourceManager) - usersClient := apimanagement.NewUserClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&usersClient.Client, o.ResourceManagerAuthorizer) + tenantAccessClient, err := tenantaccess.NewTenantAccessClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Tenant Access client: %+v", err) + } + o.Configure(tenantAccessClient.Client, o.Authorizers.ResourceManager) + + usersClient, err := user.NewUserClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building users client: %+v", err) + } + o.Configure(usersClient.Client, o.Authorizers.ResourceManager) return &Client{ - ApiClient: &apiClient, - ApiDiagnosticClient: &apiDiagnosticClient, - ApiOperationPoliciesClient: &apiOperationPoliciesClient, - ApiOperationsClient: &apiOperationsClient, - ApiPoliciesClient: &apiPoliciesClient, - ApiReleasesClient: &apiReleasesClient, - ApiSchemasClient: &apiSchemasClient, - ApiTagDescriptionClient: &apiTagDescriptionClient, - ApiVersionSetClient: &apiVersionSetClient, - AuthorizationServersClient: &authorizationServersClient, - BackendClient: &backendClient, - CacheClient: &cacheClient, - CertificatesClient: &certificatesClient, - DelegationSettingsClient: &delegationSettingsClient, - DeletedServicesClient: &deletedServicesClient, - DiagnosticClient: &diagnosticClient, - EmailTemplateClient: &emailTemplateClient, - GatewayApisClient: &gatewayApisClient, - GatewayCertificateAuthorityClient: &gatewayCertificateAuthorityClient, - GatewayClient: &gatewayClient, - GatewayHostNameConfigurationClient: &gatewayHostnameConfigurationClient, + ApiClient: apiClient, + ApiDiagnosticClient: apiDiagnosticClient, + ApiOperationPoliciesClient: apiOperationPoliciesClient, + ApiOperationsClient: apiOperationsClient, + ApiOperationTagClient: apiOperationTagClient, + ApiPoliciesClient: apiPoliciesClient, + ApiReleasesClient: apiReleasesClient, + ApiSchemasClient: apiSchemasClient, + ApiTagClient: apiTagClient, + ApiTagDescriptionClient: apiTagDescriptionClient, + ApiVersionSetClient: apiVersionSetClient, + ApiVersionSetsClient: apiVersionSetsClient, + AuthorizationServersClient: authorizationServersClient, + BackendClient: backendClient, + CacheClient: cacheClient, + CertificatesClient: certificatesClient, + DelegationSettingsClient: delegationSettingsClient, + DeletedServicesClient: deletedServicesClient, + DiagnosticClient: diagnosticClient, + EmailTemplatesClient: emailTemplatesClient, + GatewayApisClient: gatewayApisClient, + GatewayCertificateAuthorityClient: gatewayCertificateAuthorityClient, + GatewayClient: gatewayClient, + GatewayHostNameConfigurationClient: gatewayHostnameConfigurationClient, GlobalSchemaClient: globalSchemaClient, - GroupClient: &groupClient, - GroupUsersClient: &groupUsersClient, - IdentityProviderClient: &identityProviderClient, - LoggerClient: &loggerClient, - NamedValueClient: &namedValueClient, - NotificationRecipientEmailClient: ¬ificationRecipientEmailClient, - NotificationRecipientUserClient: ¬ificationRecipientUserClient, - OpenIdConnectClient: &openIdConnectClient, - PolicyClient: &policyClient, - ProductApisClient: &productApisClient, - ProductGroupsClient: &productGroupsClient, - ProductPoliciesClient: &productPoliciesClient, - ProductsClient: &productsClient, - ServiceClient: &serviceClient, - SignInClient: &signInClient, - SignUpClient: &signUpClient, - SubscriptionsClient: &subscriptionsClient, - TagClient: &tagClient, - TenantAccessClient: &tenantAccessClient, - UsersClient: &usersClient, + GroupClient: groupClient, + GroupUsersClient: groupUsersClient, + IdentityProviderClient: identityProviderClient, + LoggerClient: loggerClient, + NamedValueClient: namedValueClient, + NotificationRecipientEmailClient: notificationRecipientEmailClient, + NotificationRecipientUserClient: notificationRecipientUserClient, + OpenIdConnectClient: openIdConnectClient, + PolicyClient: policyClient, + ProductApisClient: productApisClient, + ProductGroupsClient: productGroupsClient, + ProductPoliciesClient: productPoliciesClient, + ProductsClient: productsClient, + ProductTagClient: productTagClient, + ServiceClient: serviceClient, + SignInClient: signInClient, + SignUpClient: signUpClient, + SubscriptionsClient: subscriptionsClient, + TagClient: tagClient, + TenantAccessClient: tenantAccessClient, + UsersClient: usersClient, }, nil } diff --git a/internal/services/apimanagement/identity_provider_import.go b/internal/services/apimanagement/identity_provider_import.go index ca95b15b897f..bc95009f46a0 100644 --- a/internal/services/apimanagement/identity_provider_import.go +++ b/internal/services/apimanagement/identity_provider_import.go @@ -6,20 +6,19 @@ package apimanagement import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) -func identityProviderImportFunc(providerType apimanagement.IdentityProviderType) *schema.ResourceImporter { +func identityProviderImportFunc(providerType identityprovider.IdentityProviderType) *schema.ResourceImporter { return pluginsdk.ImporterValidatingResourceId(func(id string) error { - parsed, err := parse.IdentityProviderID(id) + parsed, err := identityprovider.ParseIdentityProviderID(id) if err != nil { return err } - if parsed.Name != string(providerType) { + if parsed.IdentityProviderName != providerType { return fmt.Errorf("this resource only supports Identity Provider Type %q", string(providerType)) } diff --git a/internal/services/apimanagement/migration/api_operation_policy_v0_to_v1.go b/internal/services/apimanagement/migration/api_operation_policy_v0_to_v1.go new file mode 100644 index 000000000000..1c572cf88588 --- /dev/null +++ b/internal/services/apimanagement/migration/api_operation_policy_v0_to_v1.go @@ -0,0 +1,67 @@ +package migration + +import ( + "context" + "log" + "strings" + + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ pluginsdk.StateUpgrade = ApiManagementApiOperationPolicyV0ToV1{} + +type ApiManagementApiOperationPolicyV0ToV1 struct{} + +func (ApiManagementApiOperationPolicyV0ToV1) Schema() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + + "resource_group_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "api_management_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "api_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "operation_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "xml_content": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + }, + + "xml_link": { + Type: pluginsdk.TypeString, + Optional: true, + }, + } +} + +func (ApiManagementApiOperationPolicyV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { + return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + // old id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/instance1/apis/api1/operations/operation1/policies/xml + // new id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/instance1/apis/api1/operations/operation1 + oldId := rawState["id"].(string) + newId := strings.TrimSuffix(oldId, "/policies/xml") + + log.Printf("[DEBUG] Updating ID from %q tmakeo %q", oldId, newId) + rawState["id"] = newId + + return rawState, nil + } +} diff --git a/internal/services/apimanagement/migration/api_policy_v0_to_v1.go b/internal/services/apimanagement/migration/api_policy_v0_to_v1.go new file mode 100644 index 000000000000..db1bc9963c53 --- /dev/null +++ b/internal/services/apimanagement/migration/api_policy_v0_to_v1.go @@ -0,0 +1,61 @@ +package migration + +import ( + "context" + "log" + "strings" + + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ pluginsdk.StateUpgrade = ApiManagementApiPolicyV0ToV1{} + +type ApiManagementApiPolicyV0ToV1 struct{} + +func (ApiManagementApiPolicyV0ToV1) Schema() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + + "resource_group_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "api_management_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "api_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "xml_content": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + }, + + "xml_link": { + Type: pluginsdk.TypeString, + Optional: true, + }, + } +} + +func (ApiManagementApiPolicyV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { + return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + // old id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/apis/exampleId/policies/xml + // new id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/apis/exampleId + oldId := rawState["id"].(string) + newId := strings.TrimSuffix(oldId, "/policies/xml") + + log.Printf("[DEBUG] Updating ID from %q to %q", oldId, newId) + rawState["id"] = newId + + return rawState, nil + } +} diff --git a/internal/services/apimanagement/migration/api_product_policy_v0_to_v1.go b/internal/services/apimanagement/migration/api_product_policy_v0_to_v1.go new file mode 100644 index 000000000000..d130c31f9d10 --- /dev/null +++ b/internal/services/apimanagement/migration/api_product_policy_v0_to_v1.go @@ -0,0 +1,60 @@ +package migration + +import ( + "context" + "log" + "strings" + + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ pluginsdk.StateUpgrade = ApiManagementProductPolicyV0ToV1{} + +type ApiManagementProductPolicyV0ToV1 struct{} + +func (ApiManagementProductPolicyV0ToV1) Schema() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "resource_group_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "api_management_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "product_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "xml_content": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + }, + + "xml_link": { + Type: pluginsdk.TypeString, + Optional: true, + }, + } +} + +func (ApiManagementProductPolicyV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { + return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + // old id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/products/exampleId/policies/xml + // new id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/products/exampleId + oldId := rawState["id"].(string) + newId := strings.TrimSuffix(oldId, "/policies/xml") + + log.Printf("[DEBUG] Updating ID from %q tmakeo %q", oldId, newId) + rawState["id"] = newId + + return rawState, nil + } +} diff --git a/internal/services/apimanagement/migration/policy.go b/internal/services/apimanagement/migration/policy.go index 9bf8e625297d..e70fd6327990 100644 --- a/internal/services/apimanagement/migration/policy.go +++ b/internal/services/apimanagement/migration/policy.go @@ -8,41 +8,45 @@ import ( "fmt" "html" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) -var _ pluginsdk.StateUpgrade = ApiManagementApiPolicyV0ToV1{} +var _ pluginsdk.StateUpgrade = ApiManagementPolicyV0ToV1{} -type ApiManagementApiPolicyV0ToV1 struct{} +type ApiManagementPolicyV0ToV1 struct{} -func (ApiManagementApiPolicyV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { +func (ApiManagementPolicyV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - apiMgmtId, err := parse.ApiManagementID(rawState["id"].(string)) + apiMgmtId, err := policy.ParseServiceID(rawState["id"].(string)) if err != nil { return rawState, nil } - id := parse.NewPolicyID(apiMgmtId.SubscriptionId, apiMgmtId.ResourceGroup, apiMgmtId.ServiceName, "policy") + id := policy.NewServiceID(apiMgmtId.SubscriptionId, apiMgmtId.ResourceGroupName, apiMgmtId.ServiceName) rawState["id"] = id.ID() client := meta.(*clients.Client).ApiManagement.PolicyClient - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, apimanagement.PolicyExportFormatXML) + resp, err := client.Get(ctx, id, policy.GetOperationOptions{Format: pointer.To(policy.PolicyExportFormatXml)}) if err != nil { - return nil, fmt.Errorf("making Read request for API Management Policy (Resource Group %q / API Management Service %q / API %q): %+v", id.ResourceGroup, id.ServiceName, id.Name, err) + return nil, fmt.Errorf("making Read request for API Management Policy (Resource Group %q / API Management Service %q / API %q): %+v", id.ResourceGroupName, id.ServiceName, "policy", err) } - if properties := resp.PolicyContractProperties; properties != nil { + if model := resp.Model; model != nil && model.Properties != nil { // when you submit an `xml_link` to the API, the API downloads this link and stores it as `xml_content` // as such there is no way to set `xml_link` and we'll let Terraform handle it - rawState["xml_content"] = html.UnescapeString(*properties.Value) + rawState["xml_content"] = html.UnescapeString(model.Properties.Value) } return rawState, nil } } -func (ApiManagementApiPolicyV0ToV1) Schema() map[string]*pluginsdk.Schema { +func (ApiManagementPolicyV0ToV1) Schema() map[string]*pluginsdk.Schema { + return policySchemaForV0AndV1() +} + +func policySchemaForV0AndV1() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ "api_management_id": { Type: pluginsdk.TypeString, diff --git a/internal/services/apimanagement/migration/policy_v1_to_v2.go b/internal/services/apimanagement/migration/policy_v1_to_v2.go new file mode 100644 index 000000000000..0e02e04157d9 --- /dev/null +++ b/internal/services/apimanagement/migration/policy_v1_to_v2.go @@ -0,0 +1,31 @@ +package migration + +import ( + "context" + "log" + "strings" + + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ pluginsdk.StateUpgrade = ApiManagementPolicyV1ToV2{} + +type ApiManagementPolicyV1ToV2 struct{} + +func (ApiManagementPolicyV1ToV2) Schema() map[string]*pluginsdk.Schema { + return policySchemaForV0AndV1() +} + +func (ApiManagementPolicyV1ToV2) UpgradeFunc() pluginsdk.StateUpgraderFunc { + return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + // old id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/instance1/policies/policy + // new id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/instance1 + oldId := rawState["id"].(string) + newId := strings.TrimSuffix(oldId, "/policies/xml") + + log.Printf("[DEBUG] Updating ID from %q to %q", oldId, newId) + rawState["id"] = newId + + return rawState, nil + } +} diff --git a/internal/services/apimanagement/schemaz/api_management.go b/internal/services/apimanagement/schemaz/api_management.go index 7aceb59095ff..72042b839058 100644 --- a/internal/services/apimanagement/schemaz/api_management.go +++ b/internal/services/apimanagement/schemaz/api_management.go @@ -8,7 +8,8 @@ import ( "fmt" "strings" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -112,12 +113,12 @@ func SchemaApiManagementOperationRepresentation() *pluginsdk.Schema { } } -func ExpandApiManagementOperationRepresentation(d *pluginsdk.ResourceData, schemaPath string, input []interface{}) (*[]apimanagement.RepresentationContract, error) { +func ExpandApiManagementOperationRepresentation(d *pluginsdk.ResourceData, schemaPath string, input []interface{}) (*[]apioperation.RepresentationContract, error) { if len(input) == 0 { - return &[]apimanagement.RepresentationContract{}, nil + return &[]apioperation.RepresentationContract{}, nil } - outputs := make([]apimanagement.RepresentationContract, 0) + outputs := make([]apioperation.RepresentationContract, 0) for i, v := range input { vs := v.(map[string]interface{}) @@ -128,15 +129,15 @@ func ExpandApiManagementOperationRepresentation(d *pluginsdk.ResourceData, schem schemaId := vs["schema_id"].(string) typeName := vs["type_name"].(string) - examples := make(map[string]*apimanagement.ParameterExampleContract) + examples := make(map[string]apioperation.ParameterExampleContract) if vs["example"] != nil { examplesRaw := vs["example"].([]interface{}) examples = ExpandApiManagementOperationParameterExampleContract(examplesRaw) } - output := apimanagement.RepresentationContract{ - ContentType: utils.String(contentType), - Examples: examples, + output := apioperation.RepresentationContract{ + ContentType: contentType, + Examples: pointer.To(examples), } contentTypeIsFormData := strings.EqualFold(contentType, "multipart/form-data") || strings.EqualFold(contentType, "application/x-www-form-urlencoded") @@ -152,8 +153,8 @@ func ExpandApiManagementOperationRepresentation(d *pluginsdk.ResourceData, schem // Representation typeName can only be specified for non form data content types (multipart/form-data, application/x-www-form-urlencoded). // nolint gocritic if !contentTypeIsFormData { - output.SchemaID = utils.String(schemaId) - output.TypeName = utils.String(typeName) + output.SchemaId = pointer.To(schemaId) + output.TypeName = pointer.To(typeName) } else if schemaId != "" { return nil, fmt.Errorf("`schema_id` cannot be specified for non-form data content types (multipart/form-data, application/x-www-form-urlencoded)") } else if typeName != "" { @@ -166,7 +167,7 @@ func ExpandApiManagementOperationRepresentation(d *pluginsdk.ResourceData, schem return &outputs, nil } -func FlattenApiManagementOperationRepresentation(input *[]apimanagement.RepresentationContract) ([]interface{}, error) { +func FlattenApiManagementOperationRepresentation(input *[]apioperation.RepresentationContract) ([]interface{}, error) { if input == nil { return []interface{}{}, nil } @@ -176,9 +177,7 @@ func FlattenApiManagementOperationRepresentation(input *[]apimanagement.Represen for _, v := range *input { output := make(map[string]interface{}) - if v.ContentType != nil { - output["content_type"] = *v.ContentType - } + output["content_type"] = v.ContentType formParameter, err := FlattenApiManagementOperationParameterContract(v.FormParameters) if err != nil { @@ -187,15 +186,15 @@ func FlattenApiManagementOperationRepresentation(input *[]apimanagement.Represen output["form_parameter"] = formParameter if v.Examples != nil { - example, err := FlattenApiManagementOperationParameterExampleContract(v.Examples) + example, err := FlattenApiManagementOperationParameterExampleContract(*v.Examples) if err != nil { return nil, err } output["example"] = example } - if v.SchemaID != nil { - output["schema_id"] = *v.SchemaID + if v.SchemaId != nil { + output["schema_id"] = *v.SchemaId } if v.TypeName != nil { @@ -260,12 +259,12 @@ func SchemaApiManagementOperationParameterContract() *pluginsdk.Schema { } } -func ExpandApiManagementOperationParameterContract(d *pluginsdk.ResourceData, schemaPath string, input []interface{}) *[]apimanagement.ParameterContract { +func ExpandApiManagementOperationParameterContract(d *pluginsdk.ResourceData, schemaPath string, input []interface{}) *[]apioperation.ParameterContract { if len(input) == 0 { - return &[]apimanagement.ParameterContract{} + return &[]apioperation.ParameterContract{} } - outputs := make([]apimanagement.ParameterContract, 0) + outputs := make([]apioperation.ParameterContract, 0) for i, v := range input { vs := v.(map[string]interface{}) @@ -278,29 +277,29 @@ func ExpandApiManagementOperationParameterContract(d *pluginsdk.ResourceData, sc schemaId := vs["schema_id"].(string) typeName := vs["type_name"].(string) - examples := make(map[string]*apimanagement.ParameterExampleContract) + examples := make(map[string]apioperation.ParameterExampleContract) if vs["example"] != nil { examplesRaw := vs["example"].([]interface{}) examples = ExpandApiManagementOperationParameterExampleContract(examplesRaw) } - output := apimanagement.ParameterContract{ - Name: utils.String(name), - Description: utils.String(description), - Type: utils.String(paramType), - Required: utils.Bool(required), + output := apioperation.ParameterContract{ + Name: name, + Description: pointer.To(description), + Type: paramType, + Required: pointer.To(required), DefaultValue: nil, Values: utils.ExpandStringSlice(valuesRaw), - SchemaID: utils.String(schemaId), - TypeName: utils.String(typeName), - Examples: examples, + SchemaId: pointer.To(schemaId), + TypeName: pointer.To(typeName), + Examples: pointer.To(examples), } // DefaultValue must be included in Values, else it returns error // when DefaultValue is unset, we need to set it nil // "" is a valid DefaultValue if v, ok := d.GetOk(fmt.Sprintf("%s.%d.default_value", schemaPath, i)); ok { - output.DefaultValue = utils.String(v.(string)) + output.DefaultValue = pointer.To(v.(string)) } outputs = append(outputs, output) } @@ -308,7 +307,7 @@ func ExpandApiManagementOperationParameterContract(d *pluginsdk.ResourceData, sc return &outputs } -func FlattenApiManagementOperationParameterContract(input *[]apimanagement.ParameterContract) ([]interface{}, error) { +func FlattenApiManagementOperationParameterContract(input *[]apioperation.ParameterContract) ([]interface{}, error) { if input == nil { return []interface{}{}, nil } @@ -317,43 +316,23 @@ func FlattenApiManagementOperationParameterContract(input *[]apimanagement.Param for _, v := range *input { output := map[string]interface{}{} - if v.Name != nil { - output["name"] = *v.Name - } - - if v.Description != nil { - output["description"] = *v.Description - } - - if v.Type != nil { - output["type"] = *v.Type - } - - if v.Required != nil { - output["required"] = *v.Required - } - - if v.DefaultValue != nil { - output["default_value"] = *v.DefaultValue - } - + output["name"] = v.Name + output["description"] = pointer.From(v.Description) + output["type"] = v.Type + output["required"] = pointer.From(v.Required) + output["default_value"] = pointer.From(v.DefaultValue) output["values"] = pluginsdk.NewSet(pluginsdk.HashString, utils.FlattenStringSlice(v.Values)) if v.Examples != nil { - example, err := FlattenApiManagementOperationParameterExampleContract(v.Examples) + example, err := FlattenApiManagementOperationParameterExampleContract(*v.Examples) if err != nil { return nil, err } output["example"] = example } - if v.SchemaID != nil { - output["schema_id"] = *v.SchemaID - } - - if v.TypeName != nil { - output["type_name"] = *v.TypeName - } + output["schema_id"] = pointer.From(v.SchemaId) + output["type_name"] = pointer.From(v.TypeName) outputs = append(outputs, output) } @@ -398,46 +377,46 @@ func SchemaApiManagementOperationParameterExampleContract() *pluginsdk.Schema { } } -func ExpandApiManagementOperationParameterExampleContract(input []interface{}) map[string]*apimanagement.ParameterExampleContract { +func ExpandApiManagementOperationParameterExampleContract(input []interface{}) map[string]apioperation.ParameterExampleContract { if len(input) == 0 { - return map[string]*apimanagement.ParameterExampleContract{} + return map[string]apioperation.ParameterExampleContract{} } - outputs := make(map[string]*apimanagement.ParameterExampleContract) + outputs := make(map[string]apioperation.ParameterExampleContract) for _, v := range input { vs := v.(map[string]interface{}) - name := vs["name"].(string) - - outputs[name] = &apimanagement.ParameterExampleContract{} + example := apioperation.ParameterExampleContract{} if vs["summary"] != nil { - outputs[name].Summary = utils.String(vs["summary"].(string)) + example.Summary = pointer.To(vs["summary"].(string)) } if vs["description"] != nil { - outputs[name].Description = utils.String(vs["description"].(string)) + example.Description = pointer.To(vs["description"].(string)) } if vs["value"] != nil { var js interface{} if json.Unmarshal([]byte(vs["value"].(string)), &js) == nil { - outputs[name].Value = js + example.Value = pointer.To(js) } else { - outputs[name].Value = utils.String(vs["value"].(string)) + example.Value = pointer.To(vs["value"]) } } if vs["external_value"] != nil { - outputs[name].ExternalValue = utils.String(vs["external_value"].(string)) + example.ExternalValue = pointer.To(vs["external_value"].(string)) } + + outputs[vs["name"].(string)] = example } return outputs } -func FlattenApiManagementOperationParameterExampleContract(input map[string]*apimanagement.ParameterExampleContract) ([]interface{}, error) { +func FlattenApiManagementOperationParameterExampleContract(input map[string]apioperation.ParameterExampleContract) ([]interface{}, error) { if input == nil { return []interface{}{}, nil } @@ -447,19 +426,13 @@ func FlattenApiManagementOperationParameterExampleContract(input map[string]*api output := map[string]interface{}{} output["name"] = k - - if v.Summary != nil { - output["summary"] = *v.Summary - } - - if v.Description != nil { - output["description"] = *v.Description - } + output["summary"] = pointer.From(v.Summary) + output["description"] = pointer.From(v.Description) // value can be any type, may be a primitive value or an object // https://github.com/Azure/azure-sdk-for-go/blob/main/services/apimanagement/mgmt/2021-08-01/apimanagement/models.go#L10236 if v.Value != nil { - value, err := convert2Json(v.Value) + value, err := convert2Json(*v.Value) if err != nil { return nil, err } @@ -467,10 +440,7 @@ func FlattenApiManagementOperationParameterExampleContract(input map[string]*api output["value"] = value } - if v.ExternalValue != nil { - output["external_value"] = *v.ExternalValue - } - + output["external_value"] = pointer.From(v.ExternalValue) outputs = append(outputs, output) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/_meta.json deleted file mode 100644 index 40e42b17afb0..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "4946dbb5b2893a77ce52d08e2a855056e1acd361", - "readme": "/_/azure-rest-api-specs/specification/apimanagement/resource-manager/readme.md", - "tag": "package-2021-08", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-08 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/apimanagement/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/api.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/api.go deleted file mode 100644 index 672c099fb6b4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/api.go +++ /dev/null @@ -1,822 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// APIClient is the apiManagement Client -type APIClient struct { - BaseClient -} - -// NewAPIClient creates an instance of the APIClient client. -func NewAPIClient(subscriptionID string) APIClient { - return NewAPIClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIClientWithBaseURI creates an instance of the APIClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAPIClientWithBaseURI(baseURI string, subscriptionID string) APIClient { - return APIClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates new or updates existing specified API of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters APICreateOrUpdateParameter, ifMatch string) (result APICreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters APICreateOrUpdateParameter, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIClient) CreateOrUpdateSender(req *http.Request) (future APICreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APIClient) CreateOrUpdateResponder(resp *http.Response) (result APIContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified API of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// deleteRevisions - delete all revisions of the Api. -func (client APIClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string, deleteRevisions *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, ifMatch, deleteRevisions) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string, deleteRevisions *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteRevisions != nil { - queryParameters["deleteRevisions"] = autorest.Encode("query", *deleteRevisions) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APIClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APIClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client APIClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result APIContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIClient) GetResponder(resp *http.Response) (result APIContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client APIClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all APIs of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| serviceUrl | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| path | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| isCurrent | filter | eq, ne | |
-// top - number of records to return. -// skip - number of records to skip. -// tags - include tags in the response. -// expandAPIVersionSet - include full ApiVersionSet resource in response -func (client APIClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, tags string, expandAPIVersionSet *bool) (result APICollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.ListByService") - defer func() { - sc := -1 - if result.ac.Response.Response != nil { - sc = result.ac.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip, tags, expandAPIVersionSet) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ac.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByService", resp, "Failure sending request") - return - } - - result.ac, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ac.hasNextLink() && result.ac.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, tags string, expandAPIVersionSet *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(tags) > 0 { - queryParameters["tags"] = autorest.Encode("query", tags) - } - if expandAPIVersionSet != nil { - queryParameters["expandApiVersionSet"] = autorest.Encode("query", *expandAPIVersionSet) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIClient) ListByServiceResponder(resp *http.Response) (result APICollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIClient) listByServiceNextResults(ctx context.Context, lastResults APICollection) (result APICollection, err error) { - req, err := lastResults.aPICollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, tags string, expandAPIVersionSet *bool) (result APICollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip, tags, expandAPIVersionSet) - return -} - -// ListByTags lists a collection of apis associated with tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| apiRevision | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| path | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| isCurrent | filter | eq | |
-// top - number of records to return. -// skip - number of records to skip. -// includeNotTaggedApis - include not tagged APIs. -func (client APIClient) ListByTags(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedApis *bool) (result TagResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.ListByTags") - defer func() { - sc := -1 - if result.trc.Response.Response != nil { - sc = result.trc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "ListByTags", err.Error()) - } - - result.fn = client.listByTagsNextResults - req, err := client.ListByTagsPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, includeNotTaggedApis) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByTags", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTagsSender(req) - if err != nil { - result.trc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByTags", resp, "Failure sending request") - return - } - - result.trc, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByTags", resp, "Failure responding to request") - return - } - if result.trc.hasNextLink() && result.trc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTagsPreparer prepares the ListByTags request. -func (client APIClient) ListByTagsPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedApis *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if includeNotTaggedApis != nil { - queryParameters["includeNotTaggedApis"] = autorest.Encode("query", *includeNotTaggedApis) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apisByTags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTagsSender sends the ListByTags request. The method will close the -// http.Response Body if it receives an error. -func (client APIClient) ListByTagsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTagsResponder handles the response to the ListByTags request. The method always -// closes the http.Response Body. -func (client APIClient) ListByTagsResponder(resp *http.Response) (result TagResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTagsNextResults retrieves the next set of results, if any. -func (client APIClient) listByTagsNextResults(ctx context.Context, lastResults TagResourceCollection) (result TagResourceCollection, err error) { - req, err := lastResults.tagResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByTagsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByTagsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByTagsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTagsComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIClient) ListByTagsComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedApis *bool) (result TagResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.ListByTags") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByTags(ctx, resourceGroupName, serviceName, filter, top, skip, includeNotTaggedApis) - return -} - -// Update updates the specified API of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// parameters - API Update Contract parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters APIUpdateContract, ifMatch string) (result APIContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, apiid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters APIUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client APIClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client APIClient) UpdateResponder(resp *http.Response) (result APIContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apidiagnostic.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apidiagnostic.go deleted file mode 100644 index d14d79f51586..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apidiagnostic.go +++ /dev/null @@ -1,711 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// APIDiagnosticClient is the apiManagement Client -type APIDiagnosticClient struct { - BaseClient -} - -// NewAPIDiagnosticClient creates an instance of the APIDiagnosticClient client. -func NewAPIDiagnosticClient(subscriptionID string) APIDiagnosticClient { - return NewAPIDiagnosticClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIDiagnosticClientWithBaseURI creates an instance of the APIDiagnosticClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAPIDiagnosticClientWithBaseURI(baseURI string, subscriptionID string) APIDiagnosticClient { - return APIDiagnosticClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Diagnostic for an API or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIDiagnosticClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (result DiagnosticContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.LoggerID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DiagnosticContractProperties.Sampling", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.InclusiveMaximum, Rule: float64(100), Chain: nil}, - {Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.InclusiveMinimum, Rule: float64(0), Chain: nil}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Frontend", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Frontend.Response", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Backend", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Backend.Response", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIDiagnosticClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIDiagnosticClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APIDiagnosticClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified Diagnostic from an API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIDiagnosticClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIDiagnosticClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APIDiagnosticClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APIDiagnosticClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the Diagnostic for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -func (client APIDiagnosticClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (result DiagnosticContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIDiagnosticClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIDiagnosticClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIDiagnosticClient) GetResponder(resp *http.Response) (result DiagnosticContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -func (client APIDiagnosticClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIDiagnosticClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIDiagnosticClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIDiagnosticClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all diagnostics of an API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APIDiagnosticClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result DiagnosticCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.ListByService") - defer func() { - sc := -1 - if result.dc.Response.Response != nil { - sc = result.dc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.dc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "ListByService", resp, "Failure sending request") - return - } - - result.dc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "ListByService", resp, "Failure responding to request") - return - } - if result.dc.hasNextLink() && result.dc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIDiagnosticClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIDiagnosticClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIDiagnosticClient) ListByServiceResponder(resp *http.Response) (result DiagnosticCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIDiagnosticClient) listByServiceNextResults(ctx context.Context, lastResults DiagnosticCollection) (result DiagnosticCollection, err error) { - req, err := lastResults.diagnosticCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIDiagnosticClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result DiagnosticCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} - -// Update updates the details of the Diagnostic for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// parameters - diagnostic Update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIDiagnosticClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (result DiagnosticContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIDiagnosticClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client APIDiagnosticClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client APIDiagnosticClient) UpdateResponder(resp *http.Response) (result DiagnosticContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiexport.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiexport.go deleted file mode 100644 index 3491f79e40eb..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiexport.go +++ /dev/null @@ -1,128 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// APIExportClient is the apiManagement Client -type APIExportClient struct { - BaseClient -} - -// NewAPIExportClient creates an instance of the APIExportClient client. -func NewAPIExportClient(subscriptionID string) APIExportClient { - return NewAPIExportClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIExportClientWithBaseURI creates an instance of the APIExportClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAPIExportClientWithBaseURI(baseURI string, subscriptionID string) APIExportClient { - return APIExportClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the details of the API specified by its identifier in the format specified to the Storage Blob with SAS Key -// valid for 5 minutes. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// formatParameter - format in which to export the Api Details to the Storage Blob with Sas Key valid for 5 -// minutes. -func (client APIExportClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, formatParameter ExportFormat) (result APIExportResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIExportClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIExportClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, formatParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIExportClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIExportClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIExportClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIExportClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, formatParameter ExportFormat) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "export": autorest.Encode("query", "true"), - "format": autorest.Encode("query", formatParameter), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIExportClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIExportClient) GetResponder(resp *http.Response) (result APIExportResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiissue.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiissue.go deleted file mode 100644 index 750c310ee9ae..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiissue.go +++ /dev/null @@ -1,688 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// APIIssueClient is the apiManagement Client -type APIIssueClient struct { - BaseClient -} - -// NewAPIIssueClient creates an instance of the APIIssueClient client. -func NewAPIIssueClient(subscriptionID string) APIIssueClient { - return NewAPIIssueClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIIssueClientWithBaseURI creates an instance of the APIIssueClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAPIIssueClientWithBaseURI(baseURI string, subscriptionID string) APIIssueClient { - return APIIssueClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Issue for an API or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIIssueClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters IssueContract, ifMatch string) (result IssueContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.IssueContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.IssueContractProperties.Title", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IssueContractProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IssueContractProperties.UserID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIIssueClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters IssueContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APIIssueClient) CreateOrUpdateResponder(resp *http.Response) (result IssueContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified Issue from an API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIIssueClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIIssueClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APIIssueClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the Issue for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// expandCommentsAttachments - expand the comment attachments. -func (client APIIssueClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, expandCommentsAttachments *bool) (result IssueContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, issueID, expandCommentsAttachments) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIIssueClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, expandCommentsAttachments *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if expandCommentsAttachments != nil { - queryParameters["expandCommentsAttachments"] = autorest.Encode("query", *expandCommentsAttachments) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIIssueClient) GetResponder(resp *http.Response) (result IssueContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Issue for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -func (client APIIssueClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, issueID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIIssueClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIIssueClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all issues associated with the specified API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| userId | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| state | filter | eq | |
-// expandCommentsAttachments - expand the comment attachments. -// top - number of records to return. -// skip - number of records to skip. -func (client APIIssueClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, expandCommentsAttachments *bool, top *int32, skip *int32) (result IssueCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.ListByService") - defer func() { - sc := -1 - if result.ic.Response.Response != nil { - sc = result.ic.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, filter, expandCommentsAttachments, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ic.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "ListByService", resp, "Failure sending request") - return - } - - result.ic, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ic.hasNextLink() && result.ic.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIIssueClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, expandCommentsAttachments *bool, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if expandCommentsAttachments != nil { - queryParameters["expandCommentsAttachments"] = autorest.Encode("query", *expandCommentsAttachments) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIIssueClient) ListByServiceResponder(resp *http.Response) (result IssueCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIIssueClient) listByServiceNextResults(ctx context.Context, lastResults IssueCollection) (result IssueCollection, err error) { - req, err := lastResults.issueCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIIssueClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, expandCommentsAttachments *bool, top *int32, skip *int32) (result IssueCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, apiid, filter, expandCommentsAttachments, top, skip) - return -} - -// Update updates an existing issue for an API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIIssueClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters IssueUpdateContract, ifMatch string) (result IssueContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIIssueClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters IssueUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client APIIssueClient) UpdateResponder(resp *http.Response) (result IssueContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiissueattachment.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiissueattachment.go deleted file mode 100644 index b4c07be32649..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiissueattachment.go +++ /dev/null @@ -1,610 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// APIIssueAttachmentClient is the apiManagement Client -type APIIssueAttachmentClient struct { - BaseClient -} - -// NewAPIIssueAttachmentClient creates an instance of the APIIssueAttachmentClient client. -func NewAPIIssueAttachmentClient(subscriptionID string) APIIssueAttachmentClient { - return NewAPIIssueAttachmentClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIIssueAttachmentClientWithBaseURI creates an instance of the APIIssueAttachmentClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewAPIIssueAttachmentClientWithBaseURI(baseURI string, subscriptionID string) APIIssueAttachmentClient { - return APIIssueAttachmentClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Attachment for the Issue in an API or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// attachmentID - attachment identifier within an Issue. Must be unique in the current Issue. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIIssueAttachmentClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, parameters IssueAttachmentContract, ifMatch string) (result IssueAttachmentContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: attachmentID, - Constraints: []validation.Constraint{{Target: "attachmentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "attachmentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "attachmentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.IssueAttachmentContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.IssueAttachmentContractProperties.Title", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IssueAttachmentContractProperties.ContentFormat", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IssueAttachmentContractProperties.Content", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueAttachmentClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, attachmentID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIIssueAttachmentClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, parameters IssueAttachmentContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "attachmentId": autorest.Encode("path", attachmentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueAttachmentClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APIIssueAttachmentClient) CreateOrUpdateResponder(resp *http.Response) (result IssueAttachmentContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified comment from an Issue. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// attachmentID - attachment identifier within an Issue. Must be unique in the current Issue. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIIssueAttachmentClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: attachmentID, - Constraints: []validation.Constraint{{Target: "attachmentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "attachmentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "attachmentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueAttachmentClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, attachmentID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIIssueAttachmentClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "attachmentId": autorest.Encode("path", attachmentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueAttachmentClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APIIssueAttachmentClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the issue Attachment for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// attachmentID - attachment identifier within an Issue. Must be unique in the current Issue. -func (client APIIssueAttachmentClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (result IssueAttachmentContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: attachmentID, - Constraints: []validation.Constraint{{Target: "attachmentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "attachmentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "attachmentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueAttachmentClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, issueID, attachmentID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIIssueAttachmentClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "attachmentId": autorest.Encode("path", attachmentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueAttachmentClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIIssueAttachmentClient) GetResponder(resp *http.Response) (result IssueAttachmentContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// attachmentID - attachment identifier within an Issue. Must be unique in the current Issue. -func (client APIIssueAttachmentClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: attachmentID, - Constraints: []validation.Constraint{{Target: "attachmentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "attachmentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "attachmentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueAttachmentClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, issueID, attachmentID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIIssueAttachmentClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "attachmentId": autorest.Encode("path", attachmentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueAttachmentClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIIssueAttachmentClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all attachments for the Issue associated with the specified API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| userId | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APIIssueAttachmentClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result IssueAttachmentCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.ListByService") - defer func() { - sc := -1 - if result.iac.Response.Response != nil { - sc = result.iac.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueAttachmentClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.iac.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "ListByService", resp, "Failure sending request") - return - } - - result.iac, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "ListByService", resp, "Failure responding to request") - return - } - if result.iac.hasNextLink() && result.iac.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIIssueAttachmentClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueAttachmentClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIIssueAttachmentClient) ListByServiceResponder(resp *http.Response) (result IssueAttachmentCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIIssueAttachmentClient) listByServiceNextResults(ctx context.Context, lastResults IssueAttachmentCollection) (result IssueAttachmentCollection, err error) { - req, err := lastResults.issueAttachmentCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIIssueAttachmentClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result IssueAttachmentCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, apiid, issueID, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiissuecomment.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiissuecomment.go deleted file mode 100644 index 274d9e726613..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiissuecomment.go +++ /dev/null @@ -1,608 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// APIIssueCommentClient is the apiManagement Client -type APIIssueCommentClient struct { - BaseClient -} - -// NewAPIIssueCommentClient creates an instance of the APIIssueCommentClient client. -func NewAPIIssueCommentClient(subscriptionID string) APIIssueCommentClient { - return NewAPIIssueCommentClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIIssueCommentClientWithBaseURI creates an instance of the APIIssueCommentClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAPIIssueCommentClientWithBaseURI(baseURI string, subscriptionID string) APIIssueCommentClient { - return APIIssueCommentClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Comment for the Issue in an API or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// commentID - comment identifier within an Issue. Must be unique in the current Issue. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIIssueCommentClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, parameters IssueCommentContract, ifMatch string) (result IssueCommentContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: commentID, - Constraints: []validation.Constraint{{Target: "commentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "commentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "commentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.IssueCommentContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.IssueCommentContractProperties.Text", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IssueCommentContractProperties.UserID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueCommentClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, commentID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIIssueCommentClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, parameters IssueCommentContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "commentId": autorest.Encode("path", commentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueCommentClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APIIssueCommentClient) CreateOrUpdateResponder(resp *http.Response) (result IssueCommentContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified comment from an Issue. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// commentID - comment identifier within an Issue. Must be unique in the current Issue. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIIssueCommentClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: commentID, - Constraints: []validation.Constraint{{Target: "commentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "commentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "commentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueCommentClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, commentID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIIssueCommentClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "commentId": autorest.Encode("path", commentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueCommentClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APIIssueCommentClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the issue Comment for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// commentID - comment identifier within an Issue. Must be unique in the current Issue. -func (client APIIssueCommentClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (result IssueCommentContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: commentID, - Constraints: []validation.Constraint{{Target: "commentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "commentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "commentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueCommentClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, issueID, commentID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIIssueCommentClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "commentId": autorest.Encode("path", commentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueCommentClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIIssueCommentClient) GetResponder(resp *http.Response) (result IssueCommentContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the issue Comment for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// commentID - comment identifier within an Issue. Must be unique in the current Issue. -func (client APIIssueCommentClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: commentID, - Constraints: []validation.Constraint{{Target: "commentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "commentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "commentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueCommentClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, issueID, commentID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIIssueCommentClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "commentId": autorest.Encode("path", commentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueCommentClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIIssueCommentClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all comments for the Issue associated with the specified API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| userId | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APIIssueCommentClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result IssueCommentCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.ListByService") - defer func() { - sc := -1 - if result.icc.Response.Response != nil { - sc = result.icc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueCommentClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.icc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "ListByService", resp, "Failure sending request") - return - } - - result.icc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "ListByService", resp, "Failure responding to request") - return - } - if result.icc.hasNextLink() && result.icc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIIssueCommentClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueCommentClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIIssueCommentClient) ListByServiceResponder(resp *http.Response) (result IssueCommentCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIIssueCommentClient) listByServiceNextResults(ctx context.Context, lastResults IssueCommentCollection) (result IssueCommentCollection, err error) { - req, err := lastResults.issueCommentCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIIssueCommentClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result IssueCommentCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, apiid, issueID, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apioperation.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apioperation.go deleted file mode 100644 index 727488dd2bdb..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apioperation.go +++ /dev/null @@ -1,705 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// APIOperationClient is the apiManagement Client -type APIOperationClient struct { - BaseClient -} - -// NewAPIOperationClient creates an instance of the APIOperationClient client. -func NewAPIOperationClient(subscriptionID string) APIOperationClient { - return NewAPIOperationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIOperationClientWithBaseURI creates an instance of the APIOperationClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAPIOperationClientWithBaseURI(baseURI string, subscriptionID string) APIOperationClient { - return APIOperationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new operation in the API or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIOperationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters OperationContract, ifMatch string) (result OperationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.OperationContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.OperationContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.OperationContractProperties.DisplayName", Name: validation.MaxLength, Rule: 300, Chain: nil}, - {Target: "parameters.OperationContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.OperationContractProperties.Method", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.OperationContractProperties.URLTemplate", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.OperationContractProperties.URLTemplate", Name: validation.MaxLength, Rule: 1000, Chain: nil}, - {Target: "parameters.OperationContractProperties.URLTemplate", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, operationID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIOperationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters OperationContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APIOperationClient) CreateOrUpdateResponder(resp *http.Response) (result OperationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified operation in the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIOperationClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, operationID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIOperationClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APIOperationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the API Operation specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -func (client APIOperationClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result OperationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIOperationClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIOperationClient) GetResponder(resp *http.Response) (result OperationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the API operation specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -func (client APIOperationClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIOperationClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIOperationClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByAPI lists a collection of the operations for the specified API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| method | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -// tags - include tags in the response. -func (client APIOperationClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, tags string) (result OperationCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.ListByAPI") - defer func() { - sc := -1 - if result.oc.Response.Response != nil { - sc = result.oc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "ListByAPI", err.Error()) - } - - result.fn = client.listByAPINextResults - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip, tags) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.oc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "ListByAPI", resp, "Failure sending request") - return - } - - result.oc, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "ListByAPI", resp, "Failure responding to request") - return - } - if result.oc.hasNextLink() && result.oc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client APIOperationClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, tags string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(tags) > 0 { - queryParameters["tags"] = autorest.Encode("query", tags) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client APIOperationClient) ListByAPIResponder(resp *http.Response) (result OperationCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAPINextResults retrieves the next set of results, if any. -func (client APIOperationClient) listByAPINextResults(ctx context.Context, lastResults OperationCollection) (result OperationCollection, err error) { - req, err := lastResults.operationCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "listByAPINextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "listByAPINextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "listByAPINextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAPIComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIOperationClient) ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, tags string) (result OperationCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.ListByAPI") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByAPI(ctx, resourceGroupName, serviceName, apiid, filter, top, skip, tags) - return -} - -// Update updates the details of the operation in the API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// parameters - API Operation Update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIOperationClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters OperationUpdateContract, ifMatch string) (result OperationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, apiid, operationID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIOperationClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters OperationUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client APIOperationClient) UpdateResponder(resp *http.Response) (result OperationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apioperationpolicy.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apioperationpolicy.go deleted file mode 100644 index b130d9c769ae..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apioperationpolicy.go +++ /dev/null @@ -1,540 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// APIOperationPolicyClient is the apiManagement Client -type APIOperationPolicyClient struct { - BaseClient -} - -// NewAPIOperationPolicyClient creates an instance of the APIOperationPolicyClient client. -func NewAPIOperationPolicyClient(subscriptionID string) APIOperationPolicyClient { - return NewAPIOperationPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIOperationPolicyClientWithBaseURI creates an instance of the APIOperationPolicyClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewAPIOperationPolicyClientWithBaseURI(baseURI string, subscriptionID string) APIOperationPolicyClient { - return APIOperationPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates policy configuration for the API Operation level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// parameters - the policy contents to apply. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIOperationPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters PolicyContract, ifMatch string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationPolicyClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PolicyContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PolicyContractProperties.Value", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationPolicyClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, operationID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIOperationPolicyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters PolicyContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationPolicyClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APIOperationPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the policy configuration at the Api Operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIOperationPolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationPolicyClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationPolicyClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, operationID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIOperationPolicyClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationPolicyClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APIOperationPolicyClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the policy configuration at the API Operation level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// formatParameter - policy Export Format. -func (client APIOperationPolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, formatParameter PolicyExportFormat) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationPolicyClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationPolicyClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, formatParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIOperationPolicyClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, formatParameter PolicyExportFormat) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(formatParameter)) > 0 { - queryParameters["format"] = autorest.Encode("query", formatParameter) - } else { - queryParameters["format"] = autorest.Encode("query", "xml") - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationPolicyClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIOperationPolicyClient) GetResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the API operation policy specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -func (client APIOperationPolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationPolicyClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationPolicyClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIOperationPolicyClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationPolicyClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIOperationPolicyClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByOperation get the list of policy configuration at the API Operation level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -func (client APIOperationPolicyClient) ListByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result PolicyCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationPolicyClient.ListByOperation") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationPolicyClient", "ListByOperation", err.Error()) - } - - req, err := client.ListByOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "ListByOperation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "ListByOperation", resp, "Failure sending request") - return - } - - result, err = client.ListByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "ListByOperation", resp, "Failure responding to request") - return - } - - return -} - -// ListByOperationPreparer prepares the ListByOperation request. -func (client APIOperationPolicyClient) ListByOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByOperationSender sends the ListByOperation request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationPolicyClient) ListByOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByOperationResponder handles the response to the ListByOperation request. The method always -// closes the http.Response Body. -func (client APIOperationPolicyClient) ListByOperationResponder(resp *http.Response) (result PolicyCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apipolicy.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apipolicy.go deleted file mode 100644 index cab98a41febd..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apipolicy.go +++ /dev/null @@ -1,509 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// APIPolicyClient is the apiManagement Client -type APIPolicyClient struct { - BaseClient -} - -// NewAPIPolicyClient creates an instance of the APIPolicyClient client. -func NewAPIPolicyClient(subscriptionID string) APIPolicyClient { - return NewAPIPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIPolicyClientWithBaseURI creates an instance of the APIPolicyClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAPIPolicyClientWithBaseURI(baseURI string, subscriptionID string) APIPolicyClient { - return APIPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates policy configuration for the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// parameters - the policy contents to apply. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters PolicyContract, ifMatch string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPolicyClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PolicyContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PolicyContractProperties.Value", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIPolicyClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIPolicyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters PolicyContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIPolicyClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APIPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the policy configuration at the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIPolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPolicyClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIPolicyClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIPolicyClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APIPolicyClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APIPolicyClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the policy configuration at the API level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// formatParameter - policy Export Format. -func (client APIPolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, formatParameter PolicyExportFormat) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPolicyClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIPolicyClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, formatParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIPolicyClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, formatParameter PolicyExportFormat) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(formatParameter)) > 0 { - queryParameters["format"] = autorest.Encode("query", formatParameter) - } else { - queryParameters["format"] = autorest.Encode("query", "xml") - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIPolicyClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIPolicyClient) GetResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the API policy specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client APIPolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPolicyClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIPolicyClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIPolicyClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIPolicyClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIPolicyClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByAPI get the policy configuration at the API level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client APIPolicyClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result PolicyCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPolicyClient.ListByAPI") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIPolicyClient", "ListByAPI", err.Error()) - } - - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "ListByAPI", resp, "Failure sending request") - return - } - - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "ListByAPI", resp, "Failure responding to request") - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client APIPolicyClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client APIPolicyClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client APIPolicyClient) ListByAPIResponder(resp *http.Response) (result PolicyCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiproduct.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiproduct.go deleted file mode 100644 index ef5c060e61c4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiproduct.go +++ /dev/null @@ -1,183 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// APIProductClient is the apiManagement Client -type APIProductClient struct { - BaseClient -} - -// NewAPIProductClient creates an instance of the APIProductClient client. -func NewAPIProductClient(subscriptionID string) APIProductClient { - return NewAPIProductClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIProductClientWithBaseURI creates an instance of the APIProductClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAPIProductClientWithBaseURI(baseURI string, subscriptionID string) APIProductClient { - return APIProductClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByApis lists all Products, which the API is part of. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| displayName | filter | ge, le, eq, ne, -// gt, lt | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APIProductClient) ListByApis(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result ProductCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIProductClient.ListByApis") - defer func() { - sc := -1 - if result.pc.Response.Response != nil { - sc = result.pc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIProductClient", "ListByApis", err.Error()) - } - - result.fn = client.listByApisNextResults - req, err := client.ListByApisPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "ListByApis", nil, "Failure preparing request") - return - } - - resp, err := client.ListByApisSender(req) - if err != nil { - result.pc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "ListByApis", resp, "Failure sending request") - return - } - - result.pc, err = client.ListByApisResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "ListByApis", resp, "Failure responding to request") - return - } - if result.pc.hasNextLink() && result.pc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByApisPreparer prepares the ListByApis request. -func (client APIProductClient) ListByApisPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/products", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByApisSender sends the ListByApis request. The method will close the -// http.Response Body if it receives an error. -func (client APIProductClient) ListByApisSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByApisResponder handles the response to the ListByApis request. The method always -// closes the http.Response Body. -func (client APIProductClient) ListByApisResponder(resp *http.Response) (result ProductCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByApisNextResults retrieves the next set of results, if any. -func (client APIProductClient) listByApisNextResults(ctx context.Context, lastResults ProductCollection) (result ProductCollection, err error) { - req, err := lastResults.productCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "listByApisNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByApisSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "listByApisNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByApisResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "listByApisNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByApisComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIProductClient) ListByApisComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result ProductCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIProductClient.ListByApis") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByApis(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apirelease.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apirelease.go deleted file mode 100644 index 805dc7e4f764..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apirelease.go +++ /dev/null @@ -1,675 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// APIReleaseClient is the apiManagement Client -type APIReleaseClient struct { - BaseClient -} - -// NewAPIReleaseClient creates an instance of the APIReleaseClient client. -func NewAPIReleaseClient(subscriptionID string) APIReleaseClient { - return NewAPIReleaseClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIReleaseClientWithBaseURI creates an instance of the APIReleaseClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAPIReleaseClientWithBaseURI(baseURI string, subscriptionID string) APIReleaseClient { - return APIReleaseClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Release for the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// releaseID - release identifier within an API. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIReleaseClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters APIReleaseContract, ifMatch string) (result APIReleaseContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: releaseID, - Constraints: []validation.Constraint{{Target: "releaseID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "releaseID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "releaseID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, releaseID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIReleaseClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters APIReleaseContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "releaseId": autorest.Encode("path", releaseID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIReleaseClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APIReleaseClient) CreateOrUpdateResponder(resp *http.Response) (result APIReleaseContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified release in the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// releaseID - release identifier within an API. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIReleaseClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: releaseID, - Constraints: []validation.Constraint{{Target: "releaseID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "releaseID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "releaseID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, releaseID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIReleaseClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "releaseId": autorest.Encode("path", releaseID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APIReleaseClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APIReleaseClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns the details of an API release. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// releaseID - release identifier within an API. Must be unique in the current API Management service instance. -func (client APIReleaseClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (result APIReleaseContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: releaseID, - Constraints: []validation.Constraint{{Target: "releaseID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "releaseID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "releaseID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, releaseID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIReleaseClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "releaseId": autorest.Encode("path", releaseID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIReleaseClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIReleaseClient) GetResponder(resp *http.Response) (result APIReleaseContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag returns the etag of an API release. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// releaseID - release identifier within an API. Must be unique in the current API Management service instance. -func (client APIReleaseClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: releaseID, - Constraints: []validation.Constraint{{Target: "releaseID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "releaseID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "releaseID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, releaseID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIReleaseClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "releaseId": autorest.Encode("path", releaseID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIReleaseClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIReleaseClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all releases of an API. An API release is created when making an API Revision current. Releases -// are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip -// parameters. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| notes | filter | ge, le, eq, ne, gt, -// lt | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APIReleaseClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result APIReleaseCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.ListByService") - defer func() { - sc := -1 - if result.arc.Response.Response != nil { - sc = result.arc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.arc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "ListByService", resp, "Failure sending request") - return - } - - result.arc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "ListByService", resp, "Failure responding to request") - return - } - if result.arc.hasNextLink() && result.arc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIReleaseClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIReleaseClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIReleaseClient) ListByServiceResponder(resp *http.Response) (result APIReleaseCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIReleaseClient) listByServiceNextResults(ctx context.Context, lastResults APIReleaseCollection) (result APIReleaseCollection, err error) { - req, err := lastResults.aPIReleaseCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIReleaseClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result APIReleaseCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} - -// Update updates the details of the release of the API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// releaseID - release identifier within an API. Must be unique in the current API Management service instance. -// parameters - API Release Update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIReleaseClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters APIReleaseContract, ifMatch string) (result APIReleaseContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: releaseID, - Constraints: []validation.Constraint{{Target: "releaseID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "releaseID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "releaseID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, apiid, releaseID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIReleaseClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters APIReleaseContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "releaseId": autorest.Encode("path", releaseID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client APIReleaseClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client APIReleaseClient) UpdateResponder(resp *http.Response) (result APIReleaseContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apirevision.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apirevision.go deleted file mode 100644 index 9827814f1f20..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apirevision.go +++ /dev/null @@ -1,183 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// APIRevisionClient is the apiManagement Client -type APIRevisionClient struct { - BaseClient -} - -// NewAPIRevisionClient creates an instance of the APIRevisionClient client. -func NewAPIRevisionClient(subscriptionID string) APIRevisionClient { - return NewAPIRevisionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIRevisionClientWithBaseURI creates an instance of the APIRevisionClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAPIRevisionClientWithBaseURI(baseURI string, subscriptionID string) APIRevisionClient { - return APIRevisionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists all revisions of an API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| apiRevision | filter | ge, le, eq, ne, -// gt, lt | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APIRevisionClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result APIRevisionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIRevisionClient.ListByService") - defer func() { - sc := -1 - if result.arc.Response.Response != nil { - sc = result.arc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIRevisionClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIRevisionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.arc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIRevisionClient", "ListByService", resp, "Failure sending request") - return - } - - result.arc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIRevisionClient", "ListByService", resp, "Failure responding to request") - return - } - if result.arc.hasNextLink() && result.arc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIRevisionClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/revisions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIRevisionClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIRevisionClient) ListByServiceResponder(resp *http.Response) (result APIRevisionCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIRevisionClient) listByServiceNextResults(ctx context.Context, lastResults APIRevisionCollection) (result APIRevisionCollection, err error) { - req, err := lastResults.aPIRevisionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIRevisionClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIRevisionClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIRevisionClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIRevisionClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result APIRevisionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIRevisionClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apischema.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apischema.go deleted file mode 100644 index 38b473c6419a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apischema.go +++ /dev/null @@ -1,592 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// APISchemaClient is the apiManagement Client -type APISchemaClient struct { - BaseClient -} - -// NewAPISchemaClient creates an instance of the APISchemaClient client. -func NewAPISchemaClient(subscriptionID string) APISchemaClient { - return NewAPISchemaClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPISchemaClientWithBaseURI creates an instance of the APISchemaClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAPISchemaClientWithBaseURI(baseURI string, subscriptionID string) APISchemaClient { - return APISchemaClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates schema configuration for the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// schemaID - schema identifier within an API. Must be unique in the current API Management service instance. -// parameters - the schema contents to apply. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APISchemaClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, parameters SchemaContract, ifMatch string) (result APISchemaCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: schemaID, - Constraints: []validation.Constraint{{Target: "schemaID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "schemaID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "schemaID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SchemaContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SchemaContractProperties.ContentType", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APISchemaClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, schemaID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APISchemaClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, parameters SchemaContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaId": autorest.Encode("path", schemaID), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APISchemaClient) CreateOrUpdateSender(req *http.Request) (future APISchemaCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APISchemaClient) CreateOrUpdateResponder(resp *http.Response) (result SchemaContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the schema configuration at the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// schemaID - schema identifier within an API. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// force - if true removes all references to the schema before deleting it. -func (client APISchemaClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, ifMatch string, force *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: schemaID, - Constraints: []validation.Constraint{{Target: "schemaID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "schemaID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "schemaID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APISchemaClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, schemaID, ifMatch, force) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APISchemaClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, ifMatch string, force *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaId": autorest.Encode("path", schemaID), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if force != nil { - queryParameters["force"] = autorest.Encode("query", *force) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APISchemaClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APISchemaClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the schema configuration at the API level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// schemaID - schema identifier within an API. Must be unique in the current API Management service instance. -func (client APISchemaClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (result SchemaContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: schemaID, - Constraints: []validation.Constraint{{Target: "schemaID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "schemaID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "schemaID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APISchemaClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, schemaID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APISchemaClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaId": autorest.Encode("path", schemaID), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APISchemaClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APISchemaClient) GetResponder(resp *http.Response) (result SchemaContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the schema specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// schemaID - schema identifier within an API. Must be unique in the current API Management service instance. -func (client APISchemaClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: schemaID, - Constraints: []validation.Constraint{{Target: "schemaID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "schemaID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "schemaID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APISchemaClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, schemaID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APISchemaClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaId": autorest.Encode("path", schemaID), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APISchemaClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APISchemaClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByAPI get the schema configuration at the API level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| contentType | filter | ge, le, eq, ne, -// gt, lt | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APISchemaClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result SchemaCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.ListByAPI") - defer func() { - sc := -1 - if result.sc.Response.Response != nil { - sc = result.sc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APISchemaClient", "ListByAPI", err.Error()) - } - - result.fn = client.listByAPINextResults - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.sc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "ListByAPI", resp, "Failure sending request") - return - } - - result.sc, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "ListByAPI", resp, "Failure responding to request") - return - } - if result.sc.hasNextLink() && result.sc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client APISchemaClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client APISchemaClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client APISchemaClient) ListByAPIResponder(resp *http.Response) (result SchemaCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAPINextResults retrieves the next set of results, if any. -func (client APISchemaClient) listByAPINextResults(ctx context.Context, lastResults SchemaCollection) (result SchemaCollection, err error) { - req, err := lastResults.schemaCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "listByAPINextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "listByAPINextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "listByAPINextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAPIComplete enumerates all values, automatically crossing page boundaries as required. -func (client APISchemaClient) ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result SchemaCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.ListByAPI") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByAPI(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apitagdescription.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apitagdescription.go deleted file mode 100644 index f5fc0f93b161..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apitagdescription.go +++ /dev/null @@ -1,594 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// APITagDescriptionClient is the apiManagement Client -type APITagDescriptionClient struct { - BaseClient -} - -// NewAPITagDescriptionClient creates an instance of the APITagDescriptionClient client. -func NewAPITagDescriptionClient(subscriptionID string) APITagDescriptionClient { - return NewAPITagDescriptionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPITagDescriptionClientWithBaseURI creates an instance of the APITagDescriptionClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewAPITagDescriptionClientWithBaseURI(baseURI string, subscriptionID string) APITagDescriptionClient { - return APITagDescriptionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create/Update tag description in scope of the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagDescriptionID - tag description identifier. Used when creating tagDescription for API/Tag association. -// Based on API and Tag names. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APITagDescriptionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string, parameters TagDescriptionCreateParameters, ifMatch string) (result TagDescriptionContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APITagDescriptionClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagDescriptionID, - Constraints: []validation.Constraint{{Target: "tagDescriptionID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TagDescriptionBaseProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TagDescriptionBaseProperties.ExternalDocsURL", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TagDescriptionBaseProperties.ExternalDocsURL", Name: validation.MaxLength, Rule: 2000, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APITagDescriptionClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, tagDescriptionID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APITagDescriptionClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string, parameters TagDescriptionCreateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagDescriptionId": autorest.Encode("path", tagDescriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APITagDescriptionClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APITagDescriptionClient) CreateOrUpdateResponder(resp *http.Response) (result TagDescriptionContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete tag description for the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagDescriptionID - tag description identifier. Used when creating tagDescription for API/Tag association. -// Based on API and Tag names. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APITagDescriptionClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APITagDescriptionClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagDescriptionID, - Constraints: []validation.Constraint{{Target: "tagDescriptionID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APITagDescriptionClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, tagDescriptionID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APITagDescriptionClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagDescriptionId": autorest.Encode("path", tagDescriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APITagDescriptionClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APITagDescriptionClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get Tag description in scope of API -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagDescriptionID - tag description identifier. Used when creating tagDescription for API/Tag association. -// Based on API and Tag names. -func (client APITagDescriptionClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string) (result TagDescriptionContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APITagDescriptionClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagDescriptionID, - Constraints: []validation.Constraint{{Target: "tagDescriptionID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APITagDescriptionClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, tagDescriptionID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APITagDescriptionClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagDescriptionId": autorest.Encode("path", tagDescriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APITagDescriptionClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APITagDescriptionClient) GetResponder(resp *http.Response) (result TagDescriptionContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state version of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagDescriptionID - tag description identifier. Used when creating tagDescription for API/Tag association. -// Based on API and Tag names. -func (client APITagDescriptionClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APITagDescriptionClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagDescriptionID, - Constraints: []validation.Constraint{{Target: "tagDescriptionID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APITagDescriptionClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, tagDescriptionID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APITagDescriptionClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagDescriptionId": autorest.Encode("path", tagDescriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APITagDescriptionClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APITagDescriptionClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on -// API level but tag may be assigned to the Operations -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| displayName | filter | ge, le, eq, ne, -// gt, lt | substringof, contains, startswith, endswith |
| name | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APITagDescriptionClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result TagDescriptionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APITagDescriptionClient.ListByService") - defer func() { - sc := -1 - if result.tdc.Response.Response != nil { - sc = result.tdc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APITagDescriptionClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.tdc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "ListByService", resp, "Failure sending request") - return - } - - result.tdc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "ListByService", resp, "Failure responding to request") - return - } - if result.tdc.hasNextLink() && result.tdc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APITagDescriptionClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APITagDescriptionClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APITagDescriptionClient) ListByServiceResponder(resp *http.Response) (result TagDescriptionCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APITagDescriptionClient) listByServiceNextResults(ctx context.Context, lastResults TagDescriptionCollection) (result TagDescriptionCollection, err error) { - req, err := lastResults.tagDescriptionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APITagDescriptionClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result TagDescriptionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APITagDescriptionClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiversionset.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiversionset.go deleted file mode 100644 index b59a0d9bc3e1..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/apiversionset.go +++ /dev/null @@ -1,649 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// APIVersionSetClient is the apiManagement Client -type APIVersionSetClient struct { - BaseClient -} - -// NewAPIVersionSetClient creates an instance of the APIVersionSetClient client. -func NewAPIVersionSetClient(subscriptionID string) APIVersionSetClient { - return NewAPIVersionSetClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIVersionSetClientWithBaseURI creates an instance of the APIVersionSetClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAPIVersionSetClientWithBaseURI(baseURI string, subscriptionID string) APIVersionSetClient { - return APIVersionSetClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a Api Version Set. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// versionSetID - api Version Set identifier. Must be unique in the current API Management service instance. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIVersionSetClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters APIVersionSetContract, ifMatch string) (result APIVersionSetContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: versionSetID, - Constraints: []validation.Constraint{{Target: "versionSetID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "versionSetID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionSetID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.APIVersionSetContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.APIVersionSetContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.APIVersionSetContractProperties.DisplayName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "parameters.APIVersionSetContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, versionSetID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIVersionSetClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters APIVersionSetContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionSetId": autorest.Encode("path", versionSetID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIVersionSetClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APIVersionSetClient) CreateOrUpdateResponder(resp *http.Response) (result APIVersionSetContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes specific Api Version Set. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// versionSetID - api Version Set identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIVersionSetClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: versionSetID, - Constraints: []validation.Constraint{{Target: "versionSetID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "versionSetID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionSetID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, versionSetID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIVersionSetClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionSetId": autorest.Encode("path", versionSetID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APIVersionSetClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APIVersionSetClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the Api Version Set specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// versionSetID - api Version Set identifier. Must be unique in the current API Management service instance. -func (client APIVersionSetClient) Get(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (result APIVersionSetContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: versionSetID, - Constraints: []validation.Constraint{{Target: "versionSetID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "versionSetID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionSetID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, versionSetID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIVersionSetClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionSetId": autorest.Encode("path", versionSetID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIVersionSetClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIVersionSetClient) GetResponder(resp *http.Response) (result APIVersionSetContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Api Version Set specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// versionSetID - api Version Set identifier. Must be unique in the current API Management service instance. -func (client APIVersionSetClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: versionSetID, - Constraints: []validation.Constraint{{Target: "versionSetID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "versionSetID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionSetID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, versionSetID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIVersionSetClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionSetId": autorest.Encode("path", versionSetID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIVersionSetClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIVersionSetClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of API Version Sets in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
-// top - number of records to return. -// skip - number of records to skip. -func (client APIVersionSetClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result APIVersionSetCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.ListByService") - defer func() { - sc := -1 - if result.avsc.Response.Response != nil { - sc = result.avsc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.avsc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "ListByService", resp, "Failure sending request") - return - } - - result.avsc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "ListByService", resp, "Failure responding to request") - return - } - if result.avsc.hasNextLink() && result.avsc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIVersionSetClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIVersionSetClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIVersionSetClient) ListByServiceResponder(resp *http.Response) (result APIVersionSetCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIVersionSetClient) listByServiceNextResults(ctx context.Context, lastResults APIVersionSetCollection) (result APIVersionSetCollection, err error) { - req, err := lastResults.aPIVersionSetCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIVersionSetClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result APIVersionSetCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates the details of the Api VersionSet specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// versionSetID - api Version Set identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIVersionSetClient) Update(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters APIVersionSetUpdateParameters, ifMatch string) (result APIVersionSetContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: versionSetID, - Constraints: []validation.Constraint{{Target: "versionSetID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "versionSetID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionSetID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, versionSetID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIVersionSetClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters APIVersionSetUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionSetId": autorest.Encode("path", versionSetID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client APIVersionSetClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client APIVersionSetClient) UpdateResponder(resp *http.Response) (result APIVersionSetContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/authorizationserver.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/authorizationserver.go deleted file mode 100644 index 79ad5abee39c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/authorizationserver.go +++ /dev/null @@ -1,746 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AuthorizationServerClient is the apiManagement Client -type AuthorizationServerClient struct { - BaseClient -} - -// NewAuthorizationServerClient creates an instance of the AuthorizationServerClient client. -func NewAuthorizationServerClient(subscriptionID string) AuthorizationServerClient { - return NewAuthorizationServerClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAuthorizationServerClientWithBaseURI creates an instance of the AuthorizationServerClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewAuthorizationServerClientWithBaseURI(baseURI string, subscriptionID string) AuthorizationServerClient { - return AuthorizationServerClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates new authorization server or updates an existing authorization server. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client AuthorizationServerClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters AuthorizationServerContract, ifMatch string) (result AuthorizationServerContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AuthorizationServerContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AuthorizationServerContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AuthorizationServerContractProperties.DisplayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "parameters.AuthorizationServerContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.AuthorizationServerContractProperties.ClientRegistrationEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AuthorizationServerContractProperties.AuthorizationEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AuthorizationServerContractProperties.GrantTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AuthorizationServerContractProperties.ClientID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, authsid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AuthorizationServerClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters AuthorizationServerContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServerClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AuthorizationServerClient) CreateOrUpdateResponder(resp *http.Response) (result AuthorizationServerContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes specific authorization server instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client AuthorizationServerClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, authsid string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, authsid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AuthorizationServerClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServerClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AuthorizationServerClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the authorization server specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -func (client AuthorizationServerClient) Get(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (result AuthorizationServerContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, authsid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AuthorizationServerClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServerClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AuthorizationServerClient) GetResponder(resp *http.Response) (result AuthorizationServerContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the authorizationServer specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -func (client AuthorizationServerClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, authsid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client AuthorizationServerClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServerClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client AuthorizationServerClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of authorization servers defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client AuthorizationServerClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result AuthorizationServerCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.ListByService") - defer func() { - sc := -1 - if result.asc.Response.Response != nil { - sc = result.asc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.asc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "ListByService", resp, "Failure sending request") - return - } - - result.asc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "ListByService", resp, "Failure responding to request") - return - } - if result.asc.hasNextLink() && result.asc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client AuthorizationServerClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServerClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client AuthorizationServerClient) ListByServiceResponder(resp *http.Response) (result AuthorizationServerCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client AuthorizationServerClient) listByServiceNextResults(ctx context.Context, lastResults AuthorizationServerCollection) (result AuthorizationServerCollection, err error) { - req, err := lastResults.authorizationServerCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client AuthorizationServerClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result AuthorizationServerCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// ListSecrets gets the client secret details of the authorization server. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -func (client AuthorizationServerClient) ListSecrets(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (result AuthorizationServerSecretsContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.ListSecrets") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "ListSecrets", err.Error()) - } - - req, err := client.ListSecretsPreparer(ctx, resourceGroupName, serviceName, authsid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "ListSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.ListSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "ListSecrets", resp, "Failure sending request") - return - } - - result, err = client.ListSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "ListSecrets", resp, "Failure responding to request") - return - } - - return -} - -// ListSecretsPreparer prepares the ListSecrets request. -func (client AuthorizationServerClient) ListSecretsPreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}/listSecrets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSecretsSender sends the ListSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServerClient) ListSecretsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSecretsResponder handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (client AuthorizationServerClient) ListSecretsResponder(resp *http.Response) (result AuthorizationServerSecretsContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates the details of the authorization server specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -// parameters - oAuth2 Server settings Update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client AuthorizationServerClient) Update(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters AuthorizationServerUpdateContract, ifMatch string) (result AuthorizationServerContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, authsid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AuthorizationServerClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters AuthorizationServerUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServerClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AuthorizationServerClient) UpdateResponder(resp *http.Response) (result AuthorizationServerContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/backend.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/backend.go deleted file mode 100644 index 2b1d715bba78..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/backend.go +++ /dev/null @@ -1,742 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// BackendClient is the apiManagement Client -type BackendClient struct { - BaseClient -} - -// NewBackendClient creates an instance of the BackendClient client. -func NewBackendClient(subscriptionID string) BackendClient { - return NewBackendClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackendClientWithBaseURI creates an instance of the BackendClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewBackendClientWithBaseURI(baseURI string, subscriptionID string) BackendClient { - return BackendClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a backend. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client BackendClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters BackendContract, ifMatch string) (result BackendContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.BackendContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.BackendContractProperties.URL", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.BackendContractProperties.URL", Name: validation.MaxLength, Rule: 2000, Chain: nil}, - {Target: "parameters.BackendContractProperties.URL", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, backendID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client BackendClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters BackendContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client BackendClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client BackendClient) CreateOrUpdateResponder(resp *http.Response) (result BackendContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified backend. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client BackendClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, backendID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, backendID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client BackendClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client BackendClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client BackendClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the backend specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -func (client BackendClient) Get(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (result BackendContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, backendID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackendClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client BackendClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client BackendClient) GetResponder(resp *http.Response) (result BackendContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the backend specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -func (client BackendClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, backendID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client BackendClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client BackendClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client BackendClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of backends in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| title | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| url | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client BackendClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result BackendCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.ListByService") - defer func() { - sc := -1 - if result.bc.Response.Response != nil { - sc = result.bc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.bc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "ListByService", resp, "Failure sending request") - return - } - - result.bc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "ListByService", resp, "Failure responding to request") - return - } - if result.bc.hasNextLink() && result.bc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client BackendClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client BackendClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client BackendClient) ListByServiceResponder(resp *http.Response) (result BackendCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client BackendClient) listByServiceNextResults(ctx context.Context, lastResults BackendCollection) (result BackendCollection, err error) { - req, err := lastResults.backendCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.BackendClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.BackendClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client BackendClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result BackendCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Reconnect notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no -// timeout was specified, timeout of 2 minutes is used. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -// parameters - reconnect request parameters. -func (client BackendClient) Reconnect(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters *BackendReconnectContract) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.Reconnect") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "Reconnect", err.Error()) - } - - req, err := client.ReconnectPreparer(ctx, resourceGroupName, serviceName, backendID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Reconnect", nil, "Failure preparing request") - return - } - - resp, err := client.ReconnectSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Reconnect", resp, "Failure sending request") - return - } - - result, err = client.ReconnectResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Reconnect", resp, "Failure responding to request") - return - } - - return -} - -// ReconnectPreparer prepares the Reconnect request. -func (client BackendClient) ReconnectPreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters *BackendReconnectContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}/reconnect", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ReconnectSender sends the Reconnect request. The method will close the -// http.Response Body if it receives an error. -func (client BackendClient) ReconnectSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ReconnectResponder handles the response to the Reconnect request. The method always -// closes the http.Response Body. -func (client BackendClient) ReconnectResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates an existing backend. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client BackendClient) Update(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters BackendUpdateParameters, ifMatch string) (result BackendContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, backendID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BackendClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters BackendUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client BackendClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client BackendClient) UpdateResponder(resp *http.Response) (result BackendContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/cache.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/cache.go deleted file mode 100644 index c0d74302948b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/cache.go +++ /dev/null @@ -1,653 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// CacheClient is the apiManagement Client -type CacheClient struct { - BaseClient -} - -// NewCacheClient creates an instance of the CacheClient client. -func NewCacheClient(subscriptionID string) CacheClient { - return NewCacheClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCacheClientWithBaseURI creates an instance of the CacheClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewCacheClientWithBaseURI(baseURI string, subscriptionID string) CacheClient { - return CacheClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an External Cache to be used in Api Management instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// cacheID - identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region -// identifier). -// parameters - create or Update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client CacheClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters CacheContract, ifMatch string) (result CacheContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: cacheID, - Constraints: []validation.Constraint{{Target: "cacheID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "cacheID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "cacheID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.CacheContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CacheContractProperties.Description", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CacheContractProperties.Description", Name: validation.MaxLength, Rule: 2000, Chain: nil}}}, - {Target: "parameters.CacheContractProperties.ConnectionString", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CacheContractProperties.ConnectionString", Name: validation.MaxLength, Rule: 300, Chain: nil}}}, - {Target: "parameters.CacheContractProperties.UseFromLocation", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CacheContractProperties.UseFromLocation", Name: validation.MaxLength, Rule: 256, Chain: nil}}}, - {Target: "parameters.CacheContractProperties.ResourceID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CacheContractProperties.ResourceID", Name: validation.MaxLength, Rule: 2000, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, cacheID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CacheClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters CacheContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheId": autorest.Encode("path", cacheID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CacheClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client CacheClient) CreateOrUpdateResponder(resp *http.Response) (result CacheContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes specific Cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// cacheID - identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region -// identifier). -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client CacheClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: cacheID, - Constraints: []validation.Constraint{{Target: "cacheID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "cacheID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "cacheID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, cacheID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CacheClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheId": autorest.Encode("path", cacheID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client CacheClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client CacheClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the Cache specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// cacheID - identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region -// identifier). -func (client CacheClient) Get(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (result CacheContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: cacheID, - Constraints: []validation.Constraint{{Target: "cacheID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "cacheID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "cacheID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, cacheID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CacheClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheId": autorest.Encode("path", cacheID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CacheClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CacheClient) GetResponder(resp *http.Response) (result CacheContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Cache specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// cacheID - identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region -// identifier). -func (client CacheClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: cacheID, - Constraints: []validation.Constraint{{Target: "cacheID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "cacheID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "cacheID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, cacheID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client CacheClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheId": autorest.Encode("path", cacheID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client CacheClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client CacheClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of all external Caches in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// top - number of records to return. -// skip - number of records to skip. -func (client CacheClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result CacheCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.ListByService") - defer func() { - sc := -1 - if result.cc.Response.Response != nil { - sc = result.cc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.cc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "ListByService", resp, "Failure sending request") - return - } - - result.cc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "ListByService", resp, "Failure responding to request") - return - } - if result.cc.hasNextLink() && result.cc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client CacheClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client CacheClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client CacheClient) ListByServiceResponder(resp *http.Response) (result CacheCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client CacheClient) listByServiceNextResults(ctx context.Context, lastResults CacheCollection) (result CacheCollection, err error) { - req, err := lastResults.cacheCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.CacheClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.CacheClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client CacheClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result CacheCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, top, skip) - return -} - -// Update updates the details of the cache specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// cacheID - identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region -// identifier). -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client CacheClient) Update(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters CacheUpdateParameters, ifMatch string) (result CacheContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: cacheID, - Constraints: []validation.Constraint{{Target: "cacheID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "cacheID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "cacheID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, cacheID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CacheClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters CacheUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheId": autorest.Encode("path", cacheID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client CacheClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client CacheClient) UpdateResponder(resp *http.Response) (result CacheContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/certificate.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/certificate.go deleted file mode 100644 index 98049f83adb7..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/certificate.go +++ /dev/null @@ -1,650 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// CertificateClient is the apiManagement Client -type CertificateClient struct { - BaseClient -} - -// NewCertificateClient creates an instance of the CertificateClient client. -func NewCertificateClient(subscriptionID string) CertificateClient { - return NewCertificateClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCertificateClientWithBaseURI creates an instance of the CertificateClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewCertificateClientWithBaseURI(baseURI string, subscriptionID string) CertificateClient { - return CertificateClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the certificate being used for authentication with the backend. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -// parameters - create or Update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client CertificateClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (result CertificateContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, certificateID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CertificateClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client CertificateClient) CreateOrUpdateResponder(resp *http.Response) (result CertificateContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes specific certificate. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client CertificateClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, certificateID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CertificateClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client CertificateClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the certificate specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -func (client CertificateClient) Get(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (result CertificateContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, certificateID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CertificateClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CertificateClient) GetResponder(resp *http.Response) (result CertificateContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the certificate specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -func (client CertificateClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, certificateID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client CertificateClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client CertificateClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of all certificates in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| subject | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| thumbprint | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| expirationDate | filter | ge, le, eq, ne, gt, lt | -// |
-// top - number of records to return. -// skip - number of records to skip. -// isKeyVaultRefreshFailed - when set to true, the response contains only certificates entities which failed -// refresh. -func (client CertificateClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, isKeyVaultRefreshFailed *bool) (result CertificateCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByService") - defer func() { - sc := -1 - if result.cc.Response.Response != nil { - sc = result.cc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip, isKeyVaultRefreshFailed) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.cc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "ListByService", resp, "Failure sending request") - return - } - - result.cc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "ListByService", resp, "Failure responding to request") - return - } - if result.cc.hasNextLink() && result.cc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client CertificateClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, isKeyVaultRefreshFailed *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if isKeyVaultRefreshFailed != nil { - queryParameters["isKeyVaultRefreshFailed"] = autorest.Encode("query", *isKeyVaultRefreshFailed) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client CertificateClient) ListByServiceResponder(resp *http.Response) (result CertificateCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client CertificateClient) listByServiceNextResults(ctx context.Context, lastResults CertificateCollection) (result CertificateCollection, err error) { - req, err := lastResults.certificateCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client CertificateClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, isKeyVaultRefreshFailed *bool) (result CertificateCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip, isKeyVaultRefreshFailed) - return -} - -// RefreshSecret from KeyVault, Refresh the certificate being used for authentication with the backend. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -func (client CertificateClient) RefreshSecret(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (result CertificateContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.RefreshSecret") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "RefreshSecret", err.Error()) - } - - req, err := client.RefreshSecretPreparer(ctx, resourceGroupName, serviceName, certificateID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "RefreshSecret", nil, "Failure preparing request") - return - } - - resp, err := client.RefreshSecretSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "RefreshSecret", resp, "Failure sending request") - return - } - - result, err = client.RefreshSecretResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "RefreshSecret", resp, "Failure responding to request") - return - } - - return -} - -// RefreshSecretPreparer prepares the RefreshSecret request. -func (client CertificateClient) RefreshSecretPreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}/refreshSecret", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RefreshSecretSender sends the RefreshSecret request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) RefreshSecretSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RefreshSecretResponder handles the response to the RefreshSecret request. The method always -// closes the http.Response Body. -func (client CertificateClient) RefreshSecretResponder(resp *http.Response) (result CertificateContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/client.go deleted file mode 100644 index 5d1cd7fd87f5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/client.go +++ /dev/null @@ -1,146 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package apimanagement implements the Azure ARM Apimanagement service API version 2021-08-01. -// -// ApiManagement Client -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -const ( - // DefaultBaseURI is the default URI used for the service Apimanagement - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Apimanagement. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} - -// PerformConnectivityCheckAsync performs a connectivity check between the API Management service and a given -// destination, and returns metrics for the connection, as well as errors encountered while trying to establish it. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// connectivityCheckRequestParams - connectivity Check request parameters. -func (client BaseClient) PerformConnectivityCheckAsync(ctx context.Context, resourceGroupName string, serviceName string, connectivityCheckRequestParams ConnectivityCheckRequest) (result PerformConnectivityCheckAsyncFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PerformConnectivityCheckAsync") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: connectivityCheckRequestParams, - Constraints: []validation.Constraint{{Target: "connectivityCheckRequestParams.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "connectivityCheckRequestParams.Source.Region", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "connectivityCheckRequestParams.Destination", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "connectivityCheckRequestParams.Destination.Address", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "connectivityCheckRequestParams.Destination.Port", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.BaseClient", "PerformConnectivityCheckAsync", err.Error()) - } - - req, err := client.PerformConnectivityCheckAsyncPreparer(ctx, resourceGroupName, serviceName, connectivityCheckRequestParams) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BaseClient", "PerformConnectivityCheckAsync", nil, "Failure preparing request") - return - } - - result, err = client.PerformConnectivityCheckAsyncSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BaseClient", "PerformConnectivityCheckAsync", result.Response(), "Failure sending request") - return - } - - return -} - -// PerformConnectivityCheckAsyncPreparer prepares the PerformConnectivityCheckAsync request. -func (client BaseClient) PerformConnectivityCheckAsyncPreparer(ctx context.Context, resourceGroupName string, serviceName string, connectivityCheckRequestParams ConnectivityCheckRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck", pathParameters), - autorest.WithJSON(connectivityCheckRequestParams), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PerformConnectivityCheckAsyncSender sends the PerformConnectivityCheckAsync request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) PerformConnectivityCheckAsyncSender(req *http.Request) (future PerformConnectivityCheckAsyncFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// PerformConnectivityCheckAsyncResponder handles the response to the PerformConnectivityCheckAsync request. The method always -// closes the http.Response Body. -func (client BaseClient) PerformConnectivityCheckAsyncResponder(resp *http.Response) (result ConnectivityCheckResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/contentitem.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/contentitem.go deleted file mode 100644 index 3f4353924258..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/contentitem.go +++ /dev/null @@ -1,546 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ContentItemClient is the apiManagement Client -type ContentItemClient struct { - BaseClient -} - -// NewContentItemClient creates an instance of the ContentItemClient client. -func NewContentItemClient(subscriptionID string) ContentItemClient { - return NewContentItemClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewContentItemClientWithBaseURI creates an instance of the ContentItemClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewContentItemClientWithBaseURI(baseURI string, subscriptionID string) ContentItemClient { - return ContentItemClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new developer portal's content item specified by the provided content type. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// contentTypeID - content type identifier. -// contentItemID - content item identifier. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client ContentItemClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, contentItemID string, ifMatch string) (result ContentItemContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContentItemClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: contentTypeID, - Constraints: []validation.Constraint{{Target: "contentTypeID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "contentTypeID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: contentItemID, - Constraints: []validation.Constraint{{Target: "contentItemID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "contentItemID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ContentItemClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, contentTypeID, contentItemID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ContentItemClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, contentItemID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "contentItemId": autorest.Encode("path", contentItemID), - "contentTypeId": autorest.Encode("path", contentTypeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ContentItemClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ContentItemClient) CreateOrUpdateResponder(resp *http.Response) (result ContentItemContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete removes the specified developer portal's content item. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// contentTypeID - content type identifier. -// contentItemID - content item identifier. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client ContentItemClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, contentItemID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContentItemClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: contentTypeID, - Constraints: []validation.Constraint{{Target: "contentTypeID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "contentTypeID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: contentItemID, - Constraints: []validation.Constraint{{Target: "contentItemID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "contentItemID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ContentItemClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, contentTypeID, contentItemID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ContentItemClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, contentItemID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "contentItemId": autorest.Encode("path", contentItemID), - "contentTypeId": autorest.Encode("path", contentTypeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ContentItemClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ContentItemClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns the developer portal's content item specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// contentTypeID - content type identifier. -// contentItemID - content item identifier. -func (client ContentItemClient) Get(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, contentItemID string) (result ContentItemContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContentItemClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: contentTypeID, - Constraints: []validation.Constraint{{Target: "contentTypeID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "contentTypeID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: contentItemID, - Constraints: []validation.Constraint{{Target: "contentItemID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "contentItemID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ContentItemClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, contentTypeID, contentItemID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ContentItemClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, contentItemID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "contentItemId": autorest.Encode("path", contentItemID), - "contentTypeId": autorest.Encode("path", contentTypeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ContentItemClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ContentItemClient) GetResponder(resp *http.Response) (result ContentItemContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag returns the entity state (ETag) version of the developer portal's content item specified by its -// identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// contentTypeID - content type identifier. -// contentItemID - content item identifier. -func (client ContentItemClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, contentItemID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContentItemClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: contentTypeID, - Constraints: []validation.Constraint{{Target: "contentTypeID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "contentTypeID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: contentItemID, - Constraints: []validation.Constraint{{Target: "contentItemID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "contentItemID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ContentItemClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, contentTypeID, contentItemID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client ContentItemClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, contentItemID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "contentItemId": autorest.Encode("path", contentItemID), - "contentTypeId": autorest.Encode("path", contentTypeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client ContentItemClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client ContentItemClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists developer portal's content items specified by the provided content type. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// contentTypeID - content type identifier. -func (client ContentItemClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string) (result ContentItemCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContentItemClient.ListByService") - defer func() { - sc := -1 - if result.cic.Response.Response != nil { - sc = result.cic.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: contentTypeID, - Constraints: []validation.Constraint{{Target: "contentTypeID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "contentTypeID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ContentItemClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, contentTypeID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.cic.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "ListByService", resp, "Failure sending request") - return - } - - result.cic, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "ListByService", resp, "Failure responding to request") - return - } - if result.cic.hasNextLink() && result.cic.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client ContentItemClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "contentTypeId": autorest.Encode("path", contentTypeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client ContentItemClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client ContentItemClient) ListByServiceResponder(resp *http.Response) (result ContentItemCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client ContentItemClient) listByServiceNextResults(ctx context.Context, lastResults ContentItemCollection) (result ContentItemCollection, err error) { - req, err := lastResults.contentItemCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentItemClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ContentItemClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string) (result ContentItemCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContentItemClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, contentTypeID) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/contenttype.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/contenttype.go deleted file mode 100644 index a74c75f89b6e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/contenttype.go +++ /dev/null @@ -1,438 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ContentTypeClient is the apiManagement Client -type ContentTypeClient struct { - BaseClient -} - -// NewContentTypeClient creates an instance of the ContentTypeClient client. -func NewContentTypeClient(subscriptionID string) ContentTypeClient { - return NewContentTypeClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewContentTypeClientWithBaseURI creates an instance of the ContentTypeClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewContentTypeClientWithBaseURI(baseURI string, subscriptionID string) ContentTypeClient { - return ContentTypeClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the developer portal's content type. Content types describe content items' -// properties, validation rules, and constraints. Custom content types' identifiers need to start with the `c-` prefix. -// Built-in content types can't be modified. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// contentTypeID - content type identifier. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client ContentTypeClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, ifMatch string) (result ContentTypeContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContentTypeClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: contentTypeID, - Constraints: []validation.Constraint{{Target: "contentTypeID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "contentTypeID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ContentTypeClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, contentTypeID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentTypeClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ContentTypeClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentTypeClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ContentTypeClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "contentTypeId": autorest.Encode("path", contentTypeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ContentTypeClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ContentTypeClient) CreateOrUpdateResponder(resp *http.Response) (result ContentTypeContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete removes the specified developer portal's content type. Content types describe content items' properties, -// validation rules, and constraints. Built-in content types (with identifiers starting with the `c-` prefix) can't be -// removed. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// contentTypeID - content type identifier. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client ContentTypeClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContentTypeClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: contentTypeID, - Constraints: []validation.Constraint{{Target: "contentTypeID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "contentTypeID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ContentTypeClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, contentTypeID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentTypeClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ContentTypeClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentTypeClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ContentTypeClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "contentTypeId": autorest.Encode("path", contentTypeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ContentTypeClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ContentTypeClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the developer portal's content type. Content types describe content items' properties, -// validation rules, and constraints. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// contentTypeID - content type identifier. -func (client ContentTypeClient) Get(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string) (result ContentTypeContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContentTypeClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: contentTypeID, - Constraints: []validation.Constraint{{Target: "contentTypeID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "contentTypeID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ContentTypeClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, contentTypeID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentTypeClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ContentTypeClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentTypeClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ContentTypeClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, contentTypeID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "contentTypeId": autorest.Encode("path", contentTypeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ContentTypeClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ContentTypeClient) GetResponder(resp *http.Response) (result ContentTypeContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists the developer portal's content types. Content types describe content items' properties, -// validation rules, and constraints. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client ContentTypeClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result ContentTypeCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContentTypeClient.ListByService") - defer func() { - sc := -1 - if result.ctc.Response.Response != nil { - sc = result.ctc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ContentTypeClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentTypeClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ctc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ContentTypeClient", "ListByService", resp, "Failure sending request") - return - } - - result.ctc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentTypeClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ctc.hasNextLink() && result.ctc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client ContentTypeClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client ContentTypeClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client ContentTypeClient) ListByServiceResponder(resp *http.Response) (result ContentTypeCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client ContentTypeClient) listByServiceNextResults(ctx context.Context, lastResults ContentTypeCollection) (result ContentTypeCollection, err error) { - req, err := lastResults.contentTypeCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ContentTypeClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ContentTypeClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ContentTypeClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ContentTypeClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string) (result ContentTypeCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContentTypeClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/delegationsettings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/delegationsettings.go deleted file mode 100644 index e6d38ed273ea..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/delegationsettings.go +++ /dev/null @@ -1,465 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DelegationSettingsClient is the apiManagement Client -type DelegationSettingsClient struct { - BaseClient -} - -// NewDelegationSettingsClient creates an instance of the DelegationSettingsClient client. -func NewDelegationSettingsClient(subscriptionID string) DelegationSettingsClient { - return NewDelegationSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDelegationSettingsClientWithBaseURI creates an instance of the DelegationSettingsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewDelegationSettingsClientWithBaseURI(baseURI string, subscriptionID string) DelegationSettingsClient { - return DelegationSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update Delegation settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client DelegationSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalDelegationSettings, ifMatch string) (result PortalDelegationSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DelegationSettingsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DelegationSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DelegationSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalDelegationSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DelegationSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DelegationSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result PortalDelegationSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get Delegation Settings for the Portal. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client DelegationSettingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result PortalDelegationSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DelegationSettingsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DelegationSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DelegationSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DelegationSettingsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DelegationSettingsClient) GetResponder(resp *http.Response) (result PortalDelegationSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the DelegationSettings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client DelegationSettingsClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DelegationSettingsClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DelegationSettingsClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client DelegationSettingsClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client DelegationSettingsClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client DelegationSettingsClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListSecrets gets the secret validation key of the DelegationSettings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client DelegationSettingsClient) ListSecrets(ctx context.Context, resourceGroupName string, serviceName string) (result PortalSettingValidationKeyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DelegationSettingsClient.ListSecrets") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DelegationSettingsClient", "ListSecrets", err.Error()) - } - - req, err := client.ListSecretsPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "ListSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.ListSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "ListSecrets", resp, "Failure sending request") - return - } - - result, err = client.ListSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "ListSecrets", resp, "Failure responding to request") - return - } - - return -} - -// ListSecretsPreparer prepares the ListSecrets request. -func (client DelegationSettingsClient) ListSecretsPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation/listSecrets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSecretsSender sends the ListSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client DelegationSettingsClient) ListSecretsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSecretsResponder handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (client DelegationSettingsClient) ListSecretsResponder(resp *http.Response) (result PortalSettingValidationKeyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update Delegation settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - update Delegation settings. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client DelegationSettingsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalDelegationSettings, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DelegationSettingsClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DelegationSettingsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DelegationSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalDelegationSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DelegationSettingsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client DelegationSettingsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/deletedservices.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/deletedservices.go deleted file mode 100644 index 3b836c2d90ce..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/deletedservices.go +++ /dev/null @@ -1,316 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DeletedServicesClient is the apiManagement Client -type DeletedServicesClient struct { - BaseClient -} - -// NewDeletedServicesClient creates an instance of the DeletedServicesClient client. -func NewDeletedServicesClient(subscriptionID string) DeletedServicesClient { - return NewDeletedServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDeletedServicesClientWithBaseURI creates an instance of the DeletedServicesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDeletedServicesClientWithBaseURI(baseURI string, subscriptionID string) DeletedServicesClient { - return DeletedServicesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByName get soft-deleted Api Management Service by name. -// Parameters: -// serviceName - the name of the API Management service. -// location - the location of the deleted API Management service. -func (client DeletedServicesClient) GetByName(ctx context.Context, serviceName string, location string) (result DeletedServiceContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeletedServicesClient.GetByName") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DeletedServicesClient", "GetByName", err.Error()) - } - - req, err := client.GetByNamePreparer(ctx, serviceName, location) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DeletedServicesClient", "GetByName", nil, "Failure preparing request") - return - } - - resp, err := client.GetByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DeletedServicesClient", "GetByName", resp, "Failure sending request") - return - } - - result, err = client.GetByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DeletedServicesClient", "GetByName", resp, "Failure responding to request") - return - } - - return -} - -// GetByNamePreparer prepares the GetByName request. -func (client DeletedServicesClient) GetByNamePreparer(ctx context.Context, serviceName string, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByNameSender sends the GetByName request. The method will close the -// http.Response Body if it receives an error. -func (client DeletedServicesClient) GetByNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByNameResponder handles the response to the GetByName request. The method always -// closes the http.Response Body. -func (client DeletedServicesClient) GetByNameResponder(resp *http.Response) (result DeletedServiceContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription lists all soft-deleted services available for undelete for the given subscription. -func (client DeletedServicesClient) ListBySubscription(ctx context.Context) (result DeletedServicesCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeletedServicesClient.ListBySubscription") - defer func() { - sc := -1 - if result.dsc.Response.Response != nil { - sc = result.dsc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DeletedServicesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.dsc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DeletedServicesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.dsc, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DeletedServicesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.dsc.hasNextLink() && result.dsc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client DeletedServicesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client DeletedServicesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client DeletedServicesClient) ListBySubscriptionResponder(resp *http.Response) (result DeletedServicesCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client DeletedServicesClient) listBySubscriptionNextResults(ctx context.Context, lastResults DeletedServicesCollection) (result DeletedServicesCollection, err error) { - req, err := lastResults.deletedServicesCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.DeletedServicesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.DeletedServicesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DeletedServicesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client DeletedServicesClient) ListBySubscriptionComplete(ctx context.Context) (result DeletedServicesCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeletedServicesClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// Purge purges Api Management Service (deletes it with no option to undelete). -// Parameters: -// serviceName - the name of the API Management service. -// location - the location of the deleted API Management service. -func (client DeletedServicesClient) Purge(ctx context.Context, serviceName string, location string) (result DeletedServicesPurgeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeletedServicesClient.Purge") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DeletedServicesClient", "Purge", err.Error()) - } - - req, err := client.PurgePreparer(ctx, serviceName, location) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DeletedServicesClient", "Purge", nil, "Failure preparing request") - return - } - - result, err = client.PurgeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DeletedServicesClient", "Purge", result.Response(), "Failure sending request") - return - } - - return -} - -// PurgePreparer prepares the Purge request. -func (client DeletedServicesClient) PurgePreparer(ctx context.Context, serviceName string, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PurgeSender sends the Purge request. The method will close the -// http.Response Body if it receives an error. -func (client DeletedServicesClient) PurgeSender(req *http.Request) (future DeletedServicesPurgeFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// PurgeResponder handles the response to the Purge request. The method always -// closes the http.Response Body. -func (client DeletedServicesClient) PurgeResponder(resp *http.Response) (result DeletedServiceContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/diagnostic.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/diagnostic.go deleted file mode 100644 index 796d4d7bd424..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/diagnostic.go +++ /dev/null @@ -1,681 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DiagnosticClient is the apiManagement Client -type DiagnosticClient struct { - BaseClient -} - -// NewDiagnosticClient creates an instance of the DiagnosticClient client. -func NewDiagnosticClient(subscriptionID string) DiagnosticClient { - return NewDiagnosticClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticClientWithBaseURI creates an instance of the DiagnosticClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDiagnosticClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticClient { - return DiagnosticClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Diagnostic or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client DiagnosticClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (result DiagnosticContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.LoggerID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DiagnosticContractProperties.Sampling", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.InclusiveMaximum, Rule: float64(100), Chain: nil}, - {Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.InclusiveMinimum, Rule: float64(0), Chain: nil}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Frontend", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Frontend.Response", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Backend", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Backend.Response", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, diagnosticID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DiagnosticClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DiagnosticClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DiagnosticClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified Diagnostic. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client DiagnosticClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, diagnosticID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DiagnosticClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DiagnosticClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DiagnosticClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the Diagnostic specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -func (client DiagnosticClient) Get(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (result DiagnosticContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, diagnosticID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DiagnosticClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DiagnosticClient) GetResponder(resp *http.Response) (result DiagnosticContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Diagnostic specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -func (client DiagnosticClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, diagnosticID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client DiagnosticClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client DiagnosticClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client DiagnosticClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all diagnostics of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client DiagnosticClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result DiagnosticCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.ListByService") - defer func() { - sc := -1 - if result.dc.Response.Response != nil { - sc = result.dc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.dc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "ListByService", resp, "Failure sending request") - return - } - - result.dc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "ListByService", resp, "Failure responding to request") - return - } - if result.dc.hasNextLink() && result.dc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client DiagnosticClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client DiagnosticClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client DiagnosticClient) ListByServiceResponder(resp *http.Response) (result DiagnosticCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client DiagnosticClient) listByServiceNextResults(ctx context.Context, lastResults DiagnosticCollection) (result DiagnosticCollection, err error) { - req, err := lastResults.diagnosticCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client DiagnosticClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result DiagnosticCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates the details of the Diagnostic specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// parameters - diagnostic Update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client DiagnosticClient) Update(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (result DiagnosticContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, diagnosticID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DiagnosticClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DiagnosticClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client DiagnosticClient) UpdateResponder(resp *http.Response) (result DiagnosticContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/emailtemplate.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/emailtemplate.go deleted file mode 100644 index 3c36cc22dda9..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/emailtemplate.go +++ /dev/null @@ -1,632 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// EmailTemplateClient is the apiManagement Client -type EmailTemplateClient struct { - BaseClient -} - -// NewEmailTemplateClient creates an instance of the EmailTemplateClient client. -func NewEmailTemplateClient(subscriptionID string) EmailTemplateClient { - return NewEmailTemplateClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEmailTemplateClientWithBaseURI creates an instance of the EmailTemplateClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewEmailTemplateClientWithBaseURI(baseURI string, subscriptionID string) EmailTemplateClient { - return EmailTemplateClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates an Email Template. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// templateName - email Template Name Identifier. -// parameters - email Template update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client EmailTemplateClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, parameters EmailTemplateUpdateParameters, ifMatch string) (result EmailTemplateContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.EmailTemplateUpdateParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.EmailTemplateUpdateParameterProperties.Subject", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.EmailTemplateUpdateParameterProperties.Subject", Name: validation.MaxLength, Rule: 1000, Chain: nil}, - {Target: "parameters.EmailTemplateUpdateParameterProperties.Subject", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.EmailTemplateUpdateParameterProperties.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.EmailTemplateUpdateParameterProperties.Body", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, templateName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EmailTemplateClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, parameters EmailTemplateUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "templateName": autorest.Encode("path", templateName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client EmailTemplateClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client EmailTemplateClient) CreateOrUpdateResponder(resp *http.Response) (result EmailTemplateContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete reset the Email Template to default template provided by the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// templateName - email Template Name Identifier. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client EmailTemplateClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, templateName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EmailTemplateClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "templateName": autorest.Encode("path", templateName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client EmailTemplateClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client EmailTemplateClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the email template specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// templateName - email Template Name Identifier. -func (client EmailTemplateClient) Get(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName) (result EmailTemplateContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, templateName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EmailTemplateClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "templateName": autorest.Encode("path", templateName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client EmailTemplateClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client EmailTemplateClient) GetResponder(resp *http.Response) (result EmailTemplateContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the email template specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// templateName - email Template Name Identifier. -func (client EmailTemplateClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, templateName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client EmailTemplateClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "templateName": autorest.Encode("path", templateName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client EmailTemplateClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client EmailTemplateClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService gets all email templates -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client EmailTemplateClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result EmailTemplateCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.ListByService") - defer func() { - sc := -1 - if result.etc.Response.Response != nil { - sc = result.etc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.etc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "ListByService", resp, "Failure sending request") - return - } - - result.etc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "ListByService", resp, "Failure responding to request") - return - } - if result.etc.hasNextLink() && result.etc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client EmailTemplateClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client EmailTemplateClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client EmailTemplateClient) ListByServiceResponder(resp *http.Response) (result EmailTemplateCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client EmailTemplateClient) listByServiceNextResults(ctx context.Context, lastResults EmailTemplateCollection) (result EmailTemplateCollection, err error) { - req, err := lastResults.emailTemplateCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client EmailTemplateClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result EmailTemplateCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates API Management email template -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// templateName - email Template Name Identifier. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// parameters - update parameters. -func (client EmailTemplateClient) Update(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, ifMatch string, parameters EmailTemplateUpdateParameters) (result EmailTemplateContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, templateName, ifMatch, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client EmailTemplateClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, ifMatch string, parameters EmailTemplateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "templateName": autorest.Encode("path", templateName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client EmailTemplateClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client EmailTemplateClient) UpdateResponder(resp *http.Response) (result EmailTemplateContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/enums.go deleted file mode 100644 index 2be299fcc30c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/enums.go +++ /dev/null @@ -1,1221 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AccessIDName enumerates the values for access id name. -type AccessIDName string - -const ( - // AccessIDNameAccess ... - AccessIDNameAccess AccessIDName = "access" - // AccessIDNameGitAccess ... - AccessIDNameGitAccess AccessIDName = "gitAccess" -) - -// PossibleAccessIDNameValues returns an array of possible values for the AccessIDName const type. -func PossibleAccessIDNameValues() []AccessIDName { - return []AccessIDName{AccessIDNameAccess, AccessIDNameGitAccess} -} - -// AccessType enumerates the values for access type. -type AccessType string - -const ( - // AccessTypeAccessKey Use access key. - AccessTypeAccessKey AccessType = "AccessKey" - // AccessTypeSystemAssignedManagedIdentity Use system assigned managed identity. - AccessTypeSystemAssignedManagedIdentity AccessType = "SystemAssignedManagedIdentity" - // AccessTypeUserAssignedManagedIdentity Use user assigned managed identity. - AccessTypeUserAssignedManagedIdentity AccessType = "UserAssignedManagedIdentity" -) - -// PossibleAccessTypeValues returns an array of possible values for the AccessType const type. -func PossibleAccessTypeValues() []AccessType { - return []AccessType{AccessTypeAccessKey, AccessTypeSystemAssignedManagedIdentity, AccessTypeUserAssignedManagedIdentity} -} - -// AlwaysLog enumerates the values for always log. -type AlwaysLog string - -const ( - // AlwaysLogAllErrors Always log all erroneous request regardless of sampling settings. - AlwaysLogAllErrors AlwaysLog = "allErrors" -) - -// PossibleAlwaysLogValues returns an array of possible values for the AlwaysLog const type. -func PossibleAlwaysLogValues() []AlwaysLog { - return []AlwaysLog{AlwaysLogAllErrors} -} - -// ApimIdentityType enumerates the values for apim identity type. -type ApimIdentityType string - -const ( - // ApimIdentityTypeNone ... - ApimIdentityTypeNone ApimIdentityType = "None" - // ApimIdentityTypeSystemAssigned ... - ApimIdentityTypeSystemAssigned ApimIdentityType = "SystemAssigned" - // ApimIdentityTypeSystemAssignedUserAssigned ... - ApimIdentityTypeSystemAssignedUserAssigned ApimIdentityType = "SystemAssigned, UserAssigned" - // ApimIdentityTypeUserAssigned ... - ApimIdentityTypeUserAssigned ApimIdentityType = "UserAssigned" -) - -// PossibleApimIdentityTypeValues returns an array of possible values for the ApimIdentityType const type. -func PossibleApimIdentityTypeValues() []ApimIdentityType { - return []ApimIdentityType{ApimIdentityTypeNone, ApimIdentityTypeSystemAssigned, ApimIdentityTypeSystemAssignedUserAssigned, ApimIdentityTypeUserAssigned} -} - -// APIType enumerates the values for api type. -type APIType string - -const ( - // APITypeGraphql ... - APITypeGraphql APIType = "graphql" - // APITypeHTTP ... - APITypeHTTP APIType = "http" - // APITypeSoap ... - APITypeSoap APIType = "soap" - // APITypeWebsocket ... - APITypeWebsocket APIType = "websocket" -) - -// PossibleAPITypeValues returns an array of possible values for the APIType const type. -func PossibleAPITypeValues() []APIType { - return []APIType{APITypeGraphql, APITypeHTTP, APITypeSoap, APITypeWebsocket} -} - -// AppType enumerates the values for app type. -type AppType string - -const ( - // AppTypeDeveloperPortal User create request was sent by new developer portal. - AppTypeDeveloperPortal AppType = "developerPortal" - // AppTypePortal User create request was sent by legacy developer portal. - AppTypePortal AppType = "portal" -) - -// PossibleAppTypeValues returns an array of possible values for the AppType const type. -func PossibleAppTypeValues() []AppType { - return []AppType{AppTypeDeveloperPortal, AppTypePortal} -} - -// AsyncOperationStatus enumerates the values for async operation status. -type AsyncOperationStatus string - -const ( - // AsyncOperationStatusFailed ... - AsyncOperationStatusFailed AsyncOperationStatus = "Failed" - // AsyncOperationStatusInProgress ... - AsyncOperationStatusInProgress AsyncOperationStatus = "InProgress" - // AsyncOperationStatusStarted ... - AsyncOperationStatusStarted AsyncOperationStatus = "Started" - // AsyncOperationStatusSucceeded ... - AsyncOperationStatusSucceeded AsyncOperationStatus = "Succeeded" -) - -// PossibleAsyncOperationStatusValues returns an array of possible values for the AsyncOperationStatus const type. -func PossibleAsyncOperationStatusValues() []AsyncOperationStatus { - return []AsyncOperationStatus{AsyncOperationStatusFailed, AsyncOperationStatusInProgress, AsyncOperationStatusStarted, AsyncOperationStatusSucceeded} -} - -// AuthorizationMethod enumerates the values for authorization method. -type AuthorizationMethod string - -const ( - // AuthorizationMethodDELETE ... - AuthorizationMethodDELETE AuthorizationMethod = "DELETE" - // AuthorizationMethodGET ... - AuthorizationMethodGET AuthorizationMethod = "GET" - // AuthorizationMethodHEAD ... - AuthorizationMethodHEAD AuthorizationMethod = "HEAD" - // AuthorizationMethodOPTIONS ... - AuthorizationMethodOPTIONS AuthorizationMethod = "OPTIONS" - // AuthorizationMethodPATCH ... - AuthorizationMethodPATCH AuthorizationMethod = "PATCH" - // AuthorizationMethodPOST ... - AuthorizationMethodPOST AuthorizationMethod = "POST" - // AuthorizationMethodPUT ... - AuthorizationMethodPUT AuthorizationMethod = "PUT" - // AuthorizationMethodTRACE ... - AuthorizationMethodTRACE AuthorizationMethod = "TRACE" -) - -// PossibleAuthorizationMethodValues returns an array of possible values for the AuthorizationMethod const type. -func PossibleAuthorizationMethodValues() []AuthorizationMethod { - return []AuthorizationMethod{AuthorizationMethodDELETE, AuthorizationMethodGET, AuthorizationMethodHEAD, AuthorizationMethodOPTIONS, AuthorizationMethodPATCH, AuthorizationMethodPOST, AuthorizationMethodPUT, AuthorizationMethodTRACE} -} - -// BackendProtocol enumerates the values for backend protocol. -type BackendProtocol string - -const ( - // BackendProtocolHTTP The Backend is a RESTful service. - BackendProtocolHTTP BackendProtocol = "http" - // BackendProtocolSoap The Backend is a SOAP service. - BackendProtocolSoap BackendProtocol = "soap" -) - -// PossibleBackendProtocolValues returns an array of possible values for the BackendProtocol const type. -func PossibleBackendProtocolValues() []BackendProtocol { - return []BackendProtocol{BackendProtocolHTTP, BackendProtocolSoap} -} - -// BearerTokenSendingMethod enumerates the values for bearer token sending method. -type BearerTokenSendingMethod string - -const ( - // BearerTokenSendingMethodAuthorizationHeader ... - BearerTokenSendingMethodAuthorizationHeader BearerTokenSendingMethod = "authorizationHeader" - // BearerTokenSendingMethodQuery ... - BearerTokenSendingMethodQuery BearerTokenSendingMethod = "query" -) - -// PossibleBearerTokenSendingMethodValues returns an array of possible values for the BearerTokenSendingMethod const type. -func PossibleBearerTokenSendingMethodValues() []BearerTokenSendingMethod { - return []BearerTokenSendingMethod{BearerTokenSendingMethodAuthorizationHeader, BearerTokenSendingMethodQuery} -} - -// BearerTokenSendingMethods enumerates the values for bearer token sending methods. -type BearerTokenSendingMethods string - -const ( - // BearerTokenSendingMethodsAuthorizationHeader Access token will be transmitted in the Authorization - // header using Bearer schema - BearerTokenSendingMethodsAuthorizationHeader BearerTokenSendingMethods = "authorizationHeader" - // BearerTokenSendingMethodsQuery Access token will be transmitted as query parameters. - BearerTokenSendingMethodsQuery BearerTokenSendingMethods = "query" -) - -// PossibleBearerTokenSendingMethodsValues returns an array of possible values for the BearerTokenSendingMethods const type. -func PossibleBearerTokenSendingMethodsValues() []BearerTokenSendingMethods { - return []BearerTokenSendingMethods{BearerTokenSendingMethodsAuthorizationHeader, BearerTokenSendingMethodsQuery} -} - -// CertificateSource enumerates the values for certificate source. -type CertificateSource string - -const ( - // CertificateSourceBuiltIn ... - CertificateSourceBuiltIn CertificateSource = "BuiltIn" - // CertificateSourceCustom ... - CertificateSourceCustom CertificateSource = "Custom" - // CertificateSourceKeyVault ... - CertificateSourceKeyVault CertificateSource = "KeyVault" - // CertificateSourceManaged ... - CertificateSourceManaged CertificateSource = "Managed" -) - -// PossibleCertificateSourceValues returns an array of possible values for the CertificateSource const type. -func PossibleCertificateSourceValues() []CertificateSource { - return []CertificateSource{CertificateSourceBuiltIn, CertificateSourceCustom, CertificateSourceKeyVault, CertificateSourceManaged} -} - -// CertificateStatus enumerates the values for certificate status. -type CertificateStatus string - -const ( - // CertificateStatusCompleted ... - CertificateStatusCompleted CertificateStatus = "Completed" - // CertificateStatusFailed ... - CertificateStatusFailed CertificateStatus = "Failed" - // CertificateStatusInProgress ... - CertificateStatusInProgress CertificateStatus = "InProgress" -) - -// PossibleCertificateStatusValues returns an array of possible values for the CertificateStatus const type. -func PossibleCertificateStatusValues() []CertificateStatus { - return []CertificateStatus{CertificateStatusCompleted, CertificateStatusFailed, CertificateStatusInProgress} -} - -// ClientAuthenticationMethod enumerates the values for client authentication method. -type ClientAuthenticationMethod string - -const ( - // ClientAuthenticationMethodBasic Basic Client Authentication method. - ClientAuthenticationMethodBasic ClientAuthenticationMethod = "Basic" - // ClientAuthenticationMethodBody Body based Authentication method. - ClientAuthenticationMethodBody ClientAuthenticationMethod = "Body" -) - -// PossibleClientAuthenticationMethodValues returns an array of possible values for the ClientAuthenticationMethod const type. -func PossibleClientAuthenticationMethodValues() []ClientAuthenticationMethod { - return []ClientAuthenticationMethod{ClientAuthenticationMethodBasic, ClientAuthenticationMethodBody} -} - -// Confirmation enumerates the values for confirmation. -type Confirmation string - -const ( - // ConfirmationInvite Send an e-mail inviting the user to sign-up and complete registration. - ConfirmationInvite Confirmation = "invite" - // ConfirmationSignup Send an e-mail to the user confirming they have successfully signed up. - ConfirmationSignup Confirmation = "signup" -) - -// PossibleConfirmationValues returns an array of possible values for the Confirmation const type. -func PossibleConfirmationValues() []Confirmation { - return []Confirmation{ConfirmationInvite, ConfirmationSignup} -} - -// ConnectionStatus enumerates the values for connection status. -type ConnectionStatus string - -const ( - // ConnectionStatusConnected ... - ConnectionStatusConnected ConnectionStatus = "Connected" - // ConnectionStatusDegraded ... - ConnectionStatusDegraded ConnectionStatus = "Degraded" - // ConnectionStatusDisconnected ... - ConnectionStatusDisconnected ConnectionStatus = "Disconnected" - // ConnectionStatusUnknown ... - ConnectionStatusUnknown ConnectionStatus = "Unknown" -) - -// PossibleConnectionStatusValues returns an array of possible values for the ConnectionStatus const type. -func PossibleConnectionStatusValues() []ConnectionStatus { - return []ConnectionStatus{ConnectionStatusConnected, ConnectionStatusDegraded, ConnectionStatusDisconnected, ConnectionStatusUnknown} -} - -// ConnectivityCheckProtocol enumerates the values for connectivity check protocol. -type ConnectivityCheckProtocol string - -const ( - // ConnectivityCheckProtocolHTTP ... - ConnectivityCheckProtocolHTTP ConnectivityCheckProtocol = "HTTP" - // ConnectivityCheckProtocolHTTPS ... - ConnectivityCheckProtocolHTTPS ConnectivityCheckProtocol = "HTTPS" - // ConnectivityCheckProtocolTCP ... - ConnectivityCheckProtocolTCP ConnectivityCheckProtocol = "TCP" -) - -// PossibleConnectivityCheckProtocolValues returns an array of possible values for the ConnectivityCheckProtocol const type. -func PossibleConnectivityCheckProtocolValues() []ConnectivityCheckProtocol { - return []ConnectivityCheckProtocol{ConnectivityCheckProtocolHTTP, ConnectivityCheckProtocolHTTPS, ConnectivityCheckProtocolTCP} -} - -// ConnectivityStatusType enumerates the values for connectivity status type. -type ConnectivityStatusType string - -const ( - // ConnectivityStatusTypeFailure ... - ConnectivityStatusTypeFailure ConnectivityStatusType = "failure" - // ConnectivityStatusTypeInitializing ... - ConnectivityStatusTypeInitializing ConnectivityStatusType = "initializing" - // ConnectivityStatusTypeSuccess ... - ConnectivityStatusTypeSuccess ConnectivityStatusType = "success" -) - -// PossibleConnectivityStatusTypeValues returns an array of possible values for the ConnectivityStatusType const type. -func PossibleConnectivityStatusTypeValues() []ConnectivityStatusType { - return []ConnectivityStatusType{ConnectivityStatusTypeFailure, ConnectivityStatusTypeInitializing, ConnectivityStatusTypeSuccess} -} - -// ContentFormat enumerates the values for content format. -type ContentFormat string - -const ( - // ContentFormatGraphqlLink The GraphQL API endpoint hosted on a publicly accessible internet address. - ContentFormatGraphqlLink ContentFormat = "graphql-link" - // ContentFormatOpenapi The contents are inline and Content Type is a OpenAPI 3.0 YAML Document. - ContentFormatOpenapi ContentFormat = "openapi" - // ContentFormatOpenapijson The contents are inline and Content Type is a OpenAPI 3.0 JSON Document. - ContentFormatOpenapijson ContentFormat = "openapi+json" - // ContentFormatOpenapijsonLink The OpenAPI 3.0 JSON document is hosted on a publicly accessible internet - // address. - ContentFormatOpenapijsonLink ContentFormat = "openapi+json-link" - // ContentFormatOpenapiLink The OpenAPI 3.0 YAML document is hosted on a publicly accessible internet - // address. - ContentFormatOpenapiLink ContentFormat = "openapi-link" - // ContentFormatSwaggerJSON The contents are inline and Content Type is a OpenAPI 2.0 JSON Document. - ContentFormatSwaggerJSON ContentFormat = "swagger-json" - // ContentFormatSwaggerLinkJSON The OpenAPI 2.0 JSON document is hosted on a publicly accessible internet - // address. - ContentFormatSwaggerLinkJSON ContentFormat = "swagger-link-json" - // ContentFormatWadlLinkJSON The WADL document is hosted on a publicly accessible internet address. - ContentFormatWadlLinkJSON ContentFormat = "wadl-link-json" - // ContentFormatWadlXML The contents are inline and Content type is a WADL document. - ContentFormatWadlXML ContentFormat = "wadl-xml" - // ContentFormatWsdl The contents are inline and the document is a WSDL/Soap document. - ContentFormatWsdl ContentFormat = "wsdl" - // ContentFormatWsdlLink The WSDL document is hosted on a publicly accessible internet address. - ContentFormatWsdlLink ContentFormat = "wsdl-link" -) - -// PossibleContentFormatValues returns an array of possible values for the ContentFormat const type. -func PossibleContentFormatValues() []ContentFormat { - return []ContentFormat{ContentFormatGraphqlLink, ContentFormatOpenapi, ContentFormatOpenapijson, ContentFormatOpenapijsonLink, ContentFormatOpenapiLink, ContentFormatSwaggerJSON, ContentFormatSwaggerLinkJSON, ContentFormatWadlLinkJSON, ContentFormatWadlXML, ContentFormatWsdl, ContentFormatWsdlLink} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// DataMaskingMode enumerates the values for data masking mode. -type DataMaskingMode string - -const ( - // DataMaskingModeHide Hide the presence of an entity. - DataMaskingModeHide DataMaskingMode = "Hide" - // DataMaskingModeMask Mask the value of an entity. - DataMaskingModeMask DataMaskingMode = "Mask" -) - -// PossibleDataMaskingModeValues returns an array of possible values for the DataMaskingMode const type. -func PossibleDataMaskingModeValues() []DataMaskingMode { - return []DataMaskingMode{DataMaskingModeHide, DataMaskingModeMask} -} - -// ExportFormat enumerates the values for export format. -type ExportFormat string - -const ( - // ExportFormatOpenapi Export the Api Definition in OpenAPI 3.0 Specification as YAML document to Storage - // Blob. - ExportFormatOpenapi ExportFormat = "openapi-link" - // ExportFormatOpenapiJSON Export the Api Definition in OpenAPI 3.0 Specification as JSON document to - // Storage Blob. - ExportFormatOpenapiJSON ExportFormat = "openapi+json-link" - // ExportFormatSwagger Export the Api Definition in OpenAPI 2.0 Specification as JSON document to the - // Storage Blob. - ExportFormatSwagger ExportFormat = "swagger-link" - // ExportFormatWadl Export the Api Definition in WADL Schema to Storage Blob. - ExportFormatWadl ExportFormat = "wadl-link" - // ExportFormatWsdl Export the Api Definition in WSDL Schema to Storage Blob. This is only supported for - // APIs of Type `soap` - ExportFormatWsdl ExportFormat = "wsdl-link" -) - -// PossibleExportFormatValues returns an array of possible values for the ExportFormat const type. -func PossibleExportFormatValues() []ExportFormat { - return []ExportFormat{ExportFormatOpenapi, ExportFormatOpenapiJSON, ExportFormatSwagger, ExportFormatWadl, ExportFormatWsdl} -} - -// ExportResultFormat enumerates the values for export result format. -type ExportResultFormat string - -const ( - // ExportResultFormatOpenAPI Export the API Definition in OpenAPI Specification 3.0 to Storage Blob. - ExportResultFormatOpenAPI ExportResultFormat = "openapi-link" - // ExportResultFormatSwagger The API Definition is exported in OpenAPI Specification 2.0 format to the - // Storage Blob. - ExportResultFormatSwagger ExportResultFormat = "swagger-link-json" - // ExportResultFormatWadl Export the API Definition in WADL Schema to Storage Blob. - ExportResultFormatWadl ExportResultFormat = "wadl-link-json" - // ExportResultFormatWsdl The API Definition is exported in WSDL Schema to Storage Blob. This is only - // supported for APIs of Type `soap` - ExportResultFormatWsdl ExportResultFormat = "wsdl-link+xml" -) - -// PossibleExportResultFormatValues returns an array of possible values for the ExportResultFormat const type. -func PossibleExportResultFormatValues() []ExportResultFormat { - return []ExportResultFormat{ExportResultFormatOpenAPI, ExportResultFormatSwagger, ExportResultFormatWadl, ExportResultFormatWsdl} -} - -// GrantType enumerates the values for grant type. -type GrantType string - -const ( - // GrantTypeAuthorizationCode Authorization Code Grant flow as described - // https://tools.ietf.org/html/rfc6749#section-4.1. - GrantTypeAuthorizationCode GrantType = "authorizationCode" - // GrantTypeClientCredentials Client Credentials Grant flow as described - // https://tools.ietf.org/html/rfc6749#section-4.4. - GrantTypeClientCredentials GrantType = "clientCredentials" - // GrantTypeImplicit Implicit Code Grant flow as described https://tools.ietf.org/html/rfc6749#section-4.2. - GrantTypeImplicit GrantType = "implicit" - // GrantTypeResourceOwnerPassword Resource Owner Password Grant flow as described - // https://tools.ietf.org/html/rfc6749#section-4.3. - GrantTypeResourceOwnerPassword GrantType = "resourceOwnerPassword" -) - -// PossibleGrantTypeValues returns an array of possible values for the GrantType const type. -func PossibleGrantTypeValues() []GrantType { - return []GrantType{GrantTypeAuthorizationCode, GrantTypeClientCredentials, GrantTypeImplicit, GrantTypeResourceOwnerPassword} -} - -// GroupType enumerates the values for group type. -type GroupType string - -const ( - // GroupTypeCustom ... - GroupTypeCustom GroupType = "custom" - // GroupTypeExternal ... - GroupTypeExternal GroupType = "external" - // GroupTypeSystem ... - GroupTypeSystem GroupType = "system" -) - -// PossibleGroupTypeValues returns an array of possible values for the GroupType const type. -func PossibleGroupTypeValues() []GroupType { - return []GroupType{GroupTypeCustom, GroupTypeExternal, GroupTypeSystem} -} - -// HostnameType enumerates the values for hostname type. -type HostnameType string - -const ( - // HostnameTypeDeveloperPortal ... - HostnameTypeDeveloperPortal HostnameType = "DeveloperPortal" - // HostnameTypeManagement ... - HostnameTypeManagement HostnameType = "Management" - // HostnameTypePortal ... - HostnameTypePortal HostnameType = "Portal" - // HostnameTypeProxy ... - HostnameTypeProxy HostnameType = "Proxy" - // HostnameTypeScm ... - HostnameTypeScm HostnameType = "Scm" -) - -// PossibleHostnameTypeValues returns an array of possible values for the HostnameType const type. -func PossibleHostnameTypeValues() []HostnameType { - return []HostnameType{HostnameTypeDeveloperPortal, HostnameTypeManagement, HostnameTypePortal, HostnameTypeProxy, HostnameTypeScm} -} - -// HTTPCorrelationProtocol enumerates the values for http correlation protocol. -type HTTPCorrelationProtocol string - -const ( - // HTTPCorrelationProtocolLegacy Inject Request-Id and Request-Context headers with request correlation - // data. See - // https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md. - HTTPCorrelationProtocolLegacy HTTPCorrelationProtocol = "Legacy" - // HTTPCorrelationProtocolNone Do not read and inject correlation headers. - HTTPCorrelationProtocolNone HTTPCorrelationProtocol = "None" - // HTTPCorrelationProtocolW3C Inject Trace Context headers. See https://w3c.github.io/trace-context. - HTTPCorrelationProtocolW3C HTTPCorrelationProtocol = "W3C" -) - -// PossibleHTTPCorrelationProtocolValues returns an array of possible values for the HTTPCorrelationProtocol const type. -func PossibleHTTPCorrelationProtocolValues() []HTTPCorrelationProtocol { - return []HTTPCorrelationProtocol{HTTPCorrelationProtocolLegacy, HTTPCorrelationProtocolNone, HTTPCorrelationProtocolW3C} -} - -// IdentityProviderType enumerates the values for identity provider type. -type IdentityProviderType string - -const ( - // IdentityProviderTypeAad Azure Active Directory as Identity provider. - IdentityProviderTypeAad IdentityProviderType = "aad" - // IdentityProviderTypeAadB2C Azure Active Directory B2C as Identity provider. - IdentityProviderTypeAadB2C IdentityProviderType = "aadB2C" - // IdentityProviderTypeFacebook Facebook as Identity provider. - IdentityProviderTypeFacebook IdentityProviderType = "facebook" - // IdentityProviderTypeGoogle Google as Identity provider. - IdentityProviderTypeGoogle IdentityProviderType = "google" - // IdentityProviderTypeMicrosoft Microsoft Live as Identity provider. - IdentityProviderTypeMicrosoft IdentityProviderType = "microsoft" - // IdentityProviderTypeTwitter Twitter as Identity provider. - IdentityProviderTypeTwitter IdentityProviderType = "twitter" -) - -// PossibleIdentityProviderTypeValues returns an array of possible values for the IdentityProviderType const type. -func PossibleIdentityProviderTypeValues() []IdentityProviderType { - return []IdentityProviderType{IdentityProviderTypeAad, IdentityProviderTypeAadB2C, IdentityProviderTypeFacebook, IdentityProviderTypeGoogle, IdentityProviderTypeMicrosoft, IdentityProviderTypeTwitter} -} - -// IssueType enumerates the values for issue type. -type IssueType string - -const ( - // IssueTypeAgentStopped ... - IssueTypeAgentStopped IssueType = "AgentStopped" - // IssueTypeDNSResolution ... - IssueTypeDNSResolution IssueType = "DnsResolution" - // IssueTypeGuestFirewall ... - IssueTypeGuestFirewall IssueType = "GuestFirewall" - // IssueTypeNetworkSecurityRule ... - IssueTypeNetworkSecurityRule IssueType = "NetworkSecurityRule" - // IssueTypePlatform ... - IssueTypePlatform IssueType = "Platform" - // IssueTypePortThrottled ... - IssueTypePortThrottled IssueType = "PortThrottled" - // IssueTypeSocketBind ... - IssueTypeSocketBind IssueType = "SocketBind" - // IssueTypeUnknown ... - IssueTypeUnknown IssueType = "Unknown" - // IssueTypeUserDefinedRoute ... - IssueTypeUserDefinedRoute IssueType = "UserDefinedRoute" -) - -// PossibleIssueTypeValues returns an array of possible values for the IssueType const type. -func PossibleIssueTypeValues() []IssueType { - return []IssueType{IssueTypeAgentStopped, IssueTypeDNSResolution, IssueTypeGuestFirewall, IssueTypeNetworkSecurityRule, IssueTypePlatform, IssueTypePortThrottled, IssueTypeSocketBind, IssueTypeUnknown, IssueTypeUserDefinedRoute} -} - -// KeyType enumerates the values for key type. -type KeyType string - -const ( - // KeyTypePrimary ... - KeyTypePrimary KeyType = "primary" - // KeyTypeSecondary ... - KeyTypeSecondary KeyType = "secondary" -) - -// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. -func PossibleKeyTypeValues() []KeyType { - return []KeyType{KeyTypePrimary, KeyTypeSecondary} -} - -// LoggerType enumerates the values for logger type. -type LoggerType string - -const ( - // LoggerTypeApplicationInsights Azure Application Insights as log destination. - LoggerTypeApplicationInsights LoggerType = "applicationInsights" - // LoggerTypeAzureEventHub Azure Event Hub as log destination. - LoggerTypeAzureEventHub LoggerType = "azureEventHub" - // LoggerTypeAzureMonitor Azure Monitor - LoggerTypeAzureMonitor LoggerType = "azureMonitor" -) - -// PossibleLoggerTypeValues returns an array of possible values for the LoggerType const type. -func PossibleLoggerTypeValues() []LoggerType { - return []LoggerType{LoggerTypeApplicationInsights, LoggerTypeAzureEventHub, LoggerTypeAzureMonitor} -} - -// Method enumerates the values for method. -type Method string - -const ( - // MethodGET ... - MethodGET Method = "GET" - // MethodPOST ... - MethodPOST Method = "POST" -) - -// PossibleMethodValues returns an array of possible values for the Method const type. -func PossibleMethodValues() []Method { - return []Method{MethodGET, MethodPOST} -} - -// NameAvailabilityReason enumerates the values for name availability reason. -type NameAvailabilityReason string - -const ( - // NameAvailabilityReasonAlreadyExists ... - NameAvailabilityReasonAlreadyExists NameAvailabilityReason = "AlreadyExists" - // NameAvailabilityReasonInvalid ... - NameAvailabilityReasonInvalid NameAvailabilityReason = "Invalid" - // NameAvailabilityReasonValid ... - NameAvailabilityReasonValid NameAvailabilityReason = "Valid" -) - -// PossibleNameAvailabilityReasonValues returns an array of possible values for the NameAvailabilityReason const type. -func PossibleNameAvailabilityReasonValues() []NameAvailabilityReason { - return []NameAvailabilityReason{NameAvailabilityReasonAlreadyExists, NameAvailabilityReasonInvalid, NameAvailabilityReasonValid} -} - -// NotificationName enumerates the values for notification name. -type NotificationName string - -const ( - // NotificationNameAccountClosedPublisher The following email recipients and users will receive email - // notifications when developer closes his account. - NotificationNameAccountClosedPublisher NotificationName = "AccountClosedPublisher" - // NotificationNameBCC The following recipients will receive blind carbon copies of all emails sent to - // developers. - NotificationNameBCC NotificationName = "BCC" - // NotificationNameNewApplicationNotificationMessage The following email recipients and users will receive - // email notifications when new applications are submitted to the application gallery. - NotificationNameNewApplicationNotificationMessage NotificationName = "NewApplicationNotificationMessage" - // NotificationNameNewIssuePublisherNotificationMessage The following email recipients and users will - // receive email notifications when a new issue or comment is submitted on the developer portal. - NotificationNameNewIssuePublisherNotificationMessage NotificationName = "NewIssuePublisherNotificationMessage" - // NotificationNamePurchasePublisherNotificationMessage The following email recipients and users will - // receive email notifications about new API product subscriptions. - NotificationNamePurchasePublisherNotificationMessage NotificationName = "PurchasePublisherNotificationMessage" - // NotificationNameQuotaLimitApproachingPublisherNotificationMessage The following email recipients and - // users will receive email notifications when subscription usage gets close to usage quota. - NotificationNameQuotaLimitApproachingPublisherNotificationMessage NotificationName = "QuotaLimitApproachingPublisherNotificationMessage" - // NotificationNameRequestPublisherNotificationMessage The following email recipients and users will - // receive email notifications about subscription requests for API products requiring approval. - NotificationNameRequestPublisherNotificationMessage NotificationName = "RequestPublisherNotificationMessage" -) - -// PossibleNotificationNameValues returns an array of possible values for the NotificationName const type. -func PossibleNotificationNameValues() []NotificationName { - return []NotificationName{NotificationNameAccountClosedPublisher, NotificationNameBCC, NotificationNameNewApplicationNotificationMessage, NotificationNameNewIssuePublisherNotificationMessage, NotificationNamePurchasePublisherNotificationMessage, NotificationNameQuotaLimitApproachingPublisherNotificationMessage, NotificationNameRequestPublisherNotificationMessage} -} - -// OperationNameFormat enumerates the values for operation name format. -type OperationNameFormat string - -const ( - // OperationNameFormatName API_NAME;rev=API_REVISION - OPERATION_NAME - OperationNameFormatName OperationNameFormat = "Name" - // OperationNameFormatURL HTTP_VERB URL - OperationNameFormatURL OperationNameFormat = "Url" -) - -// PossibleOperationNameFormatValues returns an array of possible values for the OperationNameFormat const type. -func PossibleOperationNameFormatValues() []OperationNameFormat { - return []OperationNameFormat{OperationNameFormatName, OperationNameFormatURL} -} - -// Origin enumerates the values for origin. -type Origin string - -const ( - // OriginInbound ... - OriginInbound Origin = "Inbound" - // OriginLocal ... - OriginLocal Origin = "Local" - // OriginOutbound ... - OriginOutbound Origin = "Outbound" -) - -// PossibleOriginValues returns an array of possible values for the Origin const type. -func PossibleOriginValues() []Origin { - return []Origin{OriginInbound, OriginLocal, OriginOutbound} -} - -// PlatformVersion enumerates the values for platform version. -type PlatformVersion string - -const ( - // PlatformVersionMtv1 Platform running the service on Multi Tenant V1 platform. - PlatformVersionMtv1 PlatformVersion = "mtv1" - // PlatformVersionStv1 Platform running the service on Single Tenant V1 platform. - PlatformVersionStv1 PlatformVersion = "stv1" - // PlatformVersionStv2 Platform running the service on Single Tenant V2 platform. - PlatformVersionStv2 PlatformVersion = "stv2" - // PlatformVersionUndetermined Platform version cannot be determined, as compute platform is not deployed. - PlatformVersionUndetermined PlatformVersion = "undetermined" -) - -// PossiblePlatformVersionValues returns an array of possible values for the PlatformVersion const type. -func PossiblePlatformVersionValues() []PlatformVersion { - return []PlatformVersion{PlatformVersionMtv1, PlatformVersionStv1, PlatformVersionStv2, PlatformVersionUndetermined} -} - -// PolicyContentFormat enumerates the values for policy content format. -type PolicyContentFormat string - -const ( - // PolicyContentFormatRawxml The contents are inline and Content type is a non XML encoded policy document. - PolicyContentFormatRawxml PolicyContentFormat = "rawxml" - // PolicyContentFormatRawxmlLink The policy document is not Xml encoded and is hosted on a http endpoint - // accessible from the API Management service. - PolicyContentFormatRawxmlLink PolicyContentFormat = "rawxml-link" - // PolicyContentFormatXML The contents are inline and Content type is an XML document. - PolicyContentFormatXML PolicyContentFormat = "xml" - // PolicyContentFormatXMLLink The policy XML document is hosted on a http endpoint accessible from the API - // Management service. - PolicyContentFormatXMLLink PolicyContentFormat = "xml-link" -) - -// PossiblePolicyContentFormatValues returns an array of possible values for the PolicyContentFormat const type. -func PossiblePolicyContentFormatValues() []PolicyContentFormat { - return []PolicyContentFormat{PolicyContentFormatRawxml, PolicyContentFormatRawxmlLink, PolicyContentFormatXML, PolicyContentFormatXMLLink} -} - -// PolicyExportFormat enumerates the values for policy export format. -type PolicyExportFormat string - -const ( - // PolicyExportFormatRawxml The contents are inline and Content type is a non XML encoded policy document. - PolicyExportFormatRawxml PolicyExportFormat = "rawxml" - // PolicyExportFormatXML The contents are inline and Content type is an XML document. - PolicyExportFormatXML PolicyExportFormat = "xml" -) - -// PossiblePolicyExportFormatValues returns an array of possible values for the PolicyExportFormat const type. -func PossiblePolicyExportFormatValues() []PolicyExportFormat { - return []PolicyExportFormat{PolicyExportFormatRawxml, PolicyExportFormatXML} -} - -// PolicyScopeContract enumerates the values for policy scope contract. -type PolicyScopeContract string - -const ( - // PolicyScopeContractAll ... - PolicyScopeContractAll PolicyScopeContract = "All" - // PolicyScopeContractAPI ... - PolicyScopeContractAPI PolicyScopeContract = "Api" - // PolicyScopeContractOperation ... - PolicyScopeContractOperation PolicyScopeContract = "Operation" - // PolicyScopeContractProduct ... - PolicyScopeContractProduct PolicyScopeContract = "Product" - // PolicyScopeContractTenant ... - PolicyScopeContractTenant PolicyScopeContract = "Tenant" -) - -// PossiblePolicyScopeContractValues returns an array of possible values for the PolicyScopeContract const type. -func PossiblePolicyScopeContractValues() []PolicyScopeContract { - return []PolicyScopeContract{PolicyScopeContractAll, PolicyScopeContractAPI, PolicyScopeContractOperation, PolicyScopeContractProduct, PolicyScopeContractTenant} -} - -// PortalRevisionStatus enumerates the values for portal revision status. -type PortalRevisionStatus string - -const ( - // PortalRevisionStatusCompleted Portal's revision publishing completed. - PortalRevisionStatusCompleted PortalRevisionStatus = "completed" - // PortalRevisionStatusFailed Portal's revision publishing failed. - PortalRevisionStatusFailed PortalRevisionStatus = "failed" - // PortalRevisionStatusPending Portal's revision has been queued. - PortalRevisionStatusPending PortalRevisionStatus = "pending" - // PortalRevisionStatusPublishing Portal's revision is being published. - PortalRevisionStatusPublishing PortalRevisionStatus = "publishing" -) - -// PossiblePortalRevisionStatusValues returns an array of possible values for the PortalRevisionStatus const type. -func PossiblePortalRevisionStatusValues() []PortalRevisionStatus { - return []PortalRevisionStatus{PortalRevisionStatusCompleted, PortalRevisionStatusFailed, PortalRevisionStatusPending, PortalRevisionStatusPublishing} -} - -// PreferredIPVersion enumerates the values for preferred ip version. -type PreferredIPVersion string - -const ( - // PreferredIPVersionIPv4 ... - PreferredIPVersionIPv4 PreferredIPVersion = "IPv4" -) - -// PossiblePreferredIPVersionValues returns an array of possible values for the PreferredIPVersion const type. -func PossiblePreferredIPVersionValues() []PreferredIPVersion { - return []PreferredIPVersion{PreferredIPVersionIPv4} -} - -// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection -// provisioning state. -type PrivateEndpointConnectionProvisioningState string - -const ( - // PrivateEndpointConnectionProvisioningStateCreating ... - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - // PrivateEndpointConnectionProvisioningStateDeleting ... - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - // PrivateEndpointConnectionProvisioningStateFailed ... - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - // PrivateEndpointConnectionProvisioningStateSucceeded ... - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" -) - -// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. -func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { - return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded} -} - -// PrivateEndpointServiceConnectionStatus enumerates the values for private endpoint service connection status. -type PrivateEndpointServiceConnectionStatus string - -const ( - // PrivateEndpointServiceConnectionStatusApproved ... - PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - // PrivateEndpointServiceConnectionStatusPending ... - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" - // PrivateEndpointServiceConnectionStatusRejected ... - PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" -) - -// PossiblePrivateEndpointServiceConnectionStatusValues returns an array of possible values for the PrivateEndpointServiceConnectionStatus const type. -func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { - return []PrivateEndpointServiceConnectionStatus{PrivateEndpointServiceConnectionStatusApproved, PrivateEndpointServiceConnectionStatusPending, PrivateEndpointServiceConnectionStatusRejected} -} - -// ProductState enumerates the values for product state. -type ProductState string - -const ( - // ProductStateNotPublished ... - ProductStateNotPublished ProductState = "notPublished" - // ProductStatePublished ... - ProductStatePublished ProductState = "published" -) - -// PossibleProductStateValues returns an array of possible values for the ProductState const type. -func PossibleProductStateValues() []ProductState { - return []ProductState{ProductStateNotPublished, ProductStatePublished} -} - -// Protocol enumerates the values for protocol. -type Protocol string - -const ( - // ProtocolHTTP ... - ProtocolHTTP Protocol = "http" - // ProtocolHTTPS ... - ProtocolHTTPS Protocol = "https" - // ProtocolWs ... - ProtocolWs Protocol = "ws" - // ProtocolWss ... - ProtocolWss Protocol = "wss" -) - -// PossibleProtocolValues returns an array of possible values for the Protocol const type. -func PossibleProtocolValues() []Protocol { - return []Protocol{ProtocolHTTP, ProtocolHTTPS, ProtocolWs, ProtocolWss} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCreated ... - ProvisioningStateCreated ProvisioningState = "created" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCreated} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // PublicNetworkAccessDisabled ... - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - // PublicNetworkAccessEnabled ... - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} -} - -// ResourceSkuCapacityScaleType enumerates the values for resource sku capacity scale type. -type ResourceSkuCapacityScaleType string - -const ( - // ResourceSkuCapacityScaleTypeAutomatic Supported scale type automatic. - ResourceSkuCapacityScaleTypeAutomatic ResourceSkuCapacityScaleType = "automatic" - // ResourceSkuCapacityScaleTypeManual Supported scale type manual. - ResourceSkuCapacityScaleTypeManual ResourceSkuCapacityScaleType = "manual" - // ResourceSkuCapacityScaleTypeNone Scaling not supported. - ResourceSkuCapacityScaleTypeNone ResourceSkuCapacityScaleType = "none" -) - -// PossibleResourceSkuCapacityScaleTypeValues returns an array of possible values for the ResourceSkuCapacityScaleType const type. -func PossibleResourceSkuCapacityScaleTypeValues() []ResourceSkuCapacityScaleType { - return []ResourceSkuCapacityScaleType{ResourceSkuCapacityScaleTypeAutomatic, ResourceSkuCapacityScaleTypeManual, ResourceSkuCapacityScaleTypeNone} -} - -// SamplingType enumerates the values for sampling type. -type SamplingType string - -const ( - // SamplingTypeFixed Fixed-rate sampling. - SamplingTypeFixed SamplingType = "fixed" -) - -// PossibleSamplingTypeValues returns an array of possible values for the SamplingType const type. -func PossibleSamplingTypeValues() []SamplingType { - return []SamplingType{SamplingTypeFixed} -} - -// Severity enumerates the values for severity. -type Severity string - -const ( - // SeverityError ... - SeverityError Severity = "Error" - // SeverityWarning ... - SeverityWarning Severity = "Warning" -) - -// PossibleSeverityValues returns an array of possible values for the Severity const type. -func PossibleSeverityValues() []Severity { - return []Severity{SeverityError, SeverityWarning} -} - -// SkuCapacityScaleType enumerates the values for sku capacity scale type. -type SkuCapacityScaleType string - -const ( - // SkuCapacityScaleTypeAutomatic ... - SkuCapacityScaleTypeAutomatic SkuCapacityScaleType = "Automatic" - // SkuCapacityScaleTypeManual ... - SkuCapacityScaleTypeManual SkuCapacityScaleType = "Manual" - // SkuCapacityScaleTypeNone ... - SkuCapacityScaleTypeNone SkuCapacityScaleType = "None" -) - -// PossibleSkuCapacityScaleTypeValues returns an array of possible values for the SkuCapacityScaleType const type. -func PossibleSkuCapacityScaleTypeValues() []SkuCapacityScaleType { - return []SkuCapacityScaleType{SkuCapacityScaleTypeAutomatic, SkuCapacityScaleTypeManual, SkuCapacityScaleTypeNone} -} - -// SkuRestrictionsReasonCode enumerates the values for sku restrictions reason code. -type SkuRestrictionsReasonCode string - -const ( - // SkuRestrictionsReasonCodeNotAvailableForSubscription ... - SkuRestrictionsReasonCodeNotAvailableForSubscription SkuRestrictionsReasonCode = "NotAvailableForSubscription" - // SkuRestrictionsReasonCodeQuotaID ... - SkuRestrictionsReasonCodeQuotaID SkuRestrictionsReasonCode = "QuotaId" -) - -// PossibleSkuRestrictionsReasonCodeValues returns an array of possible values for the SkuRestrictionsReasonCode const type. -func PossibleSkuRestrictionsReasonCodeValues() []SkuRestrictionsReasonCode { - return []SkuRestrictionsReasonCode{SkuRestrictionsReasonCodeNotAvailableForSubscription, SkuRestrictionsReasonCodeQuotaID} -} - -// SkuRestrictionsType enumerates the values for sku restrictions type. -type SkuRestrictionsType string - -const ( - // SkuRestrictionsTypeLocation ... - SkuRestrictionsTypeLocation SkuRestrictionsType = "Location" - // SkuRestrictionsTypeZone ... - SkuRestrictionsTypeZone SkuRestrictionsType = "Zone" -) - -// PossibleSkuRestrictionsTypeValues returns an array of possible values for the SkuRestrictionsType const type. -func PossibleSkuRestrictionsTypeValues() []SkuRestrictionsType { - return []SkuRestrictionsType{SkuRestrictionsTypeLocation, SkuRestrictionsTypeZone} -} - -// SkuType enumerates the values for sku type. -type SkuType string - -const ( - // SkuTypeBasic Basic SKU of Api Management. - SkuTypeBasic SkuType = "Basic" - // SkuTypeConsumption Consumption SKU of Api Management. - SkuTypeConsumption SkuType = "Consumption" - // SkuTypeDeveloper Developer SKU of Api Management. - SkuTypeDeveloper SkuType = "Developer" - // SkuTypeIsolated Isolated SKU of Api Management. - SkuTypeIsolated SkuType = "Isolated" - // SkuTypePremium Premium SKU of Api Management. - SkuTypePremium SkuType = "Premium" - // SkuTypeStandard Standard SKU of Api Management. - SkuTypeStandard SkuType = "Standard" -) - -// PossibleSkuTypeValues returns an array of possible values for the SkuType const type. -func PossibleSkuTypeValues() []SkuType { - return []SkuType{SkuTypeBasic, SkuTypeConsumption, SkuTypeDeveloper, SkuTypeIsolated, SkuTypePremium, SkuTypeStandard} -} - -// SoapAPIType enumerates the values for soap api type. -type SoapAPIType string - -const ( - // SoapAPITypeGraphQL Imports the API having a GraphQL front end. - SoapAPITypeGraphQL SoapAPIType = "graphql" - // SoapAPITypeSoapPassThrough Imports the SOAP API having a SOAP front end. - SoapAPITypeSoapPassThrough SoapAPIType = "soap" - // SoapAPITypeSoapToRest Imports a SOAP API having a RESTful front end. - SoapAPITypeSoapToRest SoapAPIType = "http" - // SoapAPITypeWebSocket Imports the API having a Websocket front end. - SoapAPITypeWebSocket SoapAPIType = "websocket" -) - -// PossibleSoapAPITypeValues returns an array of possible values for the SoapAPIType const type. -func PossibleSoapAPITypeValues() []SoapAPIType { - return []SoapAPIType{SoapAPITypeGraphQL, SoapAPITypeSoapPassThrough, SoapAPITypeSoapToRest, SoapAPITypeWebSocket} -} - -// State enumerates the values for state. -type State string - -const ( - // StateClosed The issue was closed. - StateClosed State = "closed" - // StateOpen The issue is opened. - StateOpen State = "open" - // StateProposed The issue is proposed. - StateProposed State = "proposed" - // StateRemoved The issue was removed. - StateRemoved State = "removed" - // StateResolved The issue is now resolved. - StateResolved State = "resolved" -) - -// PossibleStateValues returns an array of possible values for the State const type. -func PossibleStateValues() []State { - return []State{StateClosed, StateOpen, StateProposed, StateRemoved, StateResolved} -} - -// StoreName enumerates the values for store name. -type StoreName string - -const ( - // StoreNameCertificateAuthority ... - StoreNameCertificateAuthority StoreName = "CertificateAuthority" - // StoreNameRoot ... - StoreNameRoot StoreName = "Root" -) - -// PossibleStoreNameValues returns an array of possible values for the StoreName const type. -func PossibleStoreNameValues() []StoreName { - return []StoreName{StoreNameCertificateAuthority, StoreNameRoot} -} - -// SubscriptionState enumerates the values for subscription state. -type SubscriptionState string - -const ( - // SubscriptionStateActive ... - SubscriptionStateActive SubscriptionState = "active" - // SubscriptionStateCancelled ... - SubscriptionStateCancelled SubscriptionState = "cancelled" - // SubscriptionStateExpired ... - SubscriptionStateExpired SubscriptionState = "expired" - // SubscriptionStateRejected ... - SubscriptionStateRejected SubscriptionState = "rejected" - // SubscriptionStateSubmitted ... - SubscriptionStateSubmitted SubscriptionState = "submitted" - // SubscriptionStateSuspended ... - SubscriptionStateSuspended SubscriptionState = "suspended" -) - -// PossibleSubscriptionStateValues returns an array of possible values for the SubscriptionState const type. -func PossibleSubscriptionStateValues() []SubscriptionState { - return []SubscriptionState{SubscriptionStateActive, SubscriptionStateCancelled, SubscriptionStateExpired, SubscriptionStateRejected, SubscriptionStateSubmitted, SubscriptionStateSuspended} -} - -// TemplateName enumerates the values for template name. -type TemplateName string - -const ( - // TemplateNameAccountClosedDeveloper ... - TemplateNameAccountClosedDeveloper TemplateName = "accountClosedDeveloper" - // TemplateNameApplicationApprovedNotificationMessage ... - TemplateNameApplicationApprovedNotificationMessage TemplateName = "applicationApprovedNotificationMessage" - // TemplateNameConfirmSignUpIdentityDefault ... - TemplateNameConfirmSignUpIdentityDefault TemplateName = "confirmSignUpIdentityDefault" - // TemplateNameEmailChangeIdentityDefault ... - TemplateNameEmailChangeIdentityDefault TemplateName = "emailChangeIdentityDefault" - // TemplateNameInviteUserNotificationMessage ... - TemplateNameInviteUserNotificationMessage TemplateName = "inviteUserNotificationMessage" - // TemplateNameNewCommentNotificationMessage ... - TemplateNameNewCommentNotificationMessage TemplateName = "newCommentNotificationMessage" - // TemplateNameNewDeveloperNotificationMessage ... - TemplateNameNewDeveloperNotificationMessage TemplateName = "newDeveloperNotificationMessage" - // TemplateNameNewIssueNotificationMessage ... - TemplateNameNewIssueNotificationMessage TemplateName = "newIssueNotificationMessage" - // TemplateNamePasswordResetByAdminNotificationMessage ... - TemplateNamePasswordResetByAdminNotificationMessage TemplateName = "passwordResetByAdminNotificationMessage" - // TemplateNamePasswordResetIdentityDefault ... - TemplateNamePasswordResetIdentityDefault TemplateName = "passwordResetIdentityDefault" - // TemplateNamePurchaseDeveloperNotificationMessage ... - TemplateNamePurchaseDeveloperNotificationMessage TemplateName = "purchaseDeveloperNotificationMessage" - // TemplateNameQuotaLimitApproachingDeveloperNotificationMessage ... - TemplateNameQuotaLimitApproachingDeveloperNotificationMessage TemplateName = "quotaLimitApproachingDeveloperNotificationMessage" - // TemplateNameRejectDeveloperNotificationMessage ... - TemplateNameRejectDeveloperNotificationMessage TemplateName = "rejectDeveloperNotificationMessage" - // TemplateNameRequestDeveloperNotificationMessage ... - TemplateNameRequestDeveloperNotificationMessage TemplateName = "requestDeveloperNotificationMessage" -) - -// PossibleTemplateNameValues returns an array of possible values for the TemplateName const type. -func PossibleTemplateNameValues() []TemplateName { - return []TemplateName{TemplateNameAccountClosedDeveloper, TemplateNameApplicationApprovedNotificationMessage, TemplateNameConfirmSignUpIdentityDefault, TemplateNameEmailChangeIdentityDefault, TemplateNameInviteUserNotificationMessage, TemplateNameNewCommentNotificationMessage, TemplateNameNewDeveloperNotificationMessage, TemplateNameNewIssueNotificationMessage, TemplateNamePasswordResetByAdminNotificationMessage, TemplateNamePasswordResetIdentityDefault, TemplateNamePurchaseDeveloperNotificationMessage, TemplateNameQuotaLimitApproachingDeveloperNotificationMessage, TemplateNameRejectDeveloperNotificationMessage, TemplateNameRequestDeveloperNotificationMessage} -} - -// UserState enumerates the values for user state. -type UserState string - -const ( - // UserStateActive User state is active. - UserStateActive UserState = "active" - // UserStateBlocked User is blocked. Blocked users cannot authenticate at developer portal or call API. - UserStateBlocked UserState = "blocked" - // UserStateDeleted User account is closed. All identities and related entities are removed. - UserStateDeleted UserState = "deleted" - // UserStatePending User account is pending. Requires identity confirmation before it can be made active. - UserStatePending UserState = "pending" -) - -// PossibleUserStateValues returns an array of possible values for the UserState const type. -func PossibleUserStateValues() []UserState { - return []UserState{UserStateActive, UserStateBlocked, UserStateDeleted, UserStatePending} -} - -// Verbosity enumerates the values for verbosity. -type Verbosity string - -const ( - // VerbosityError Only traces with 'severity' set to 'error' will be sent to the logger attached to this - // diagnostic instance. - VerbosityError Verbosity = "error" - // VerbosityInformation Traces with 'severity' set to 'information' and 'error' will be sent to the logger - // attached to this diagnostic instance. - VerbosityInformation Verbosity = "information" - // VerbosityVerbose All the traces emitted by trace policies will be sent to the logger attached to this - // diagnostic instance. - VerbosityVerbose Verbosity = "verbose" -) - -// PossibleVerbosityValues returns an array of possible values for the Verbosity const type. -func PossibleVerbosityValues() []Verbosity { - return []Verbosity{VerbosityError, VerbosityInformation, VerbosityVerbose} -} - -// VersioningScheme enumerates the values for versioning scheme. -type VersioningScheme string - -const ( - // VersioningSchemeHeader The API Version is passed in a HTTP header. - VersioningSchemeHeader VersioningScheme = "Header" - // VersioningSchemeQuery The API Version is passed in a query parameter. - VersioningSchemeQuery VersioningScheme = "Query" - // VersioningSchemeSegment The API Version is passed in a path segment. - VersioningSchemeSegment VersioningScheme = "Segment" -) - -// PossibleVersioningSchemeValues returns an array of possible values for the VersioningScheme const type. -func PossibleVersioningSchemeValues() []VersioningScheme { - return []VersioningScheme{VersioningSchemeHeader, VersioningSchemeQuery, VersioningSchemeSegment} -} - -// VersioningScheme1 enumerates the values for versioning scheme 1. -type VersioningScheme1 string - -const ( - // VersioningScheme1Header ... - VersioningScheme1Header VersioningScheme1 = "Header" - // VersioningScheme1Query ... - VersioningScheme1Query VersioningScheme1 = "Query" - // VersioningScheme1Segment ... - VersioningScheme1Segment VersioningScheme1 = "Segment" -) - -// PossibleVersioningScheme1Values returns an array of possible values for the VersioningScheme1 const type. -func PossibleVersioningScheme1Values() []VersioningScheme1 { - return []VersioningScheme1{VersioningScheme1Header, VersioningScheme1Query, VersioningScheme1Segment} -} - -// VirtualNetworkType enumerates the values for virtual network type. -type VirtualNetworkType string - -const ( - // VirtualNetworkTypeExternal The service is part of Virtual Network and it is accessible from Internet. - VirtualNetworkTypeExternal VirtualNetworkType = "External" - // VirtualNetworkTypeInternal The service is part of Virtual Network and it is only accessible from within - // the virtual network. - VirtualNetworkTypeInternal VirtualNetworkType = "Internal" - // VirtualNetworkTypeNone The service is not part of any Virtual Network. - VirtualNetworkTypeNone VirtualNetworkType = "None" -) - -// PossibleVirtualNetworkTypeValues returns an array of possible values for the VirtualNetworkType const type. -func PossibleVirtualNetworkTypeValues() []VirtualNetworkType { - return []VirtualNetworkType{VirtualNetworkTypeExternal, VirtualNetworkTypeInternal, VirtualNetworkTypeNone} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gateway.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gateway.go deleted file mode 100644 index 5e59fd5ec746..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gateway.go +++ /dev/null @@ -1,933 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// GatewayClient is the apiManagement Client -type GatewayClient struct { - BaseClient -} - -// NewGatewayClient creates an instance of the GatewayClient client. -func NewGatewayClient(subscriptionID string) GatewayClient { - return NewGatewayClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGatewayClientWithBaseURI creates an instance of the GatewayClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewGatewayClientWithBaseURI(baseURI string, subscriptionID string) GatewayClient { - return GatewayClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Gateway to be used in Api Management instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client GatewayClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayContract, ifMatch string) (result GatewayContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.GatewayContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.GatewayContractProperties.LocationData", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.GatewayContractProperties.LocationData.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.GatewayContractProperties.LocationData.Name", Name: validation.MaxLength, Rule: 256, Chain: nil}}}, - {Target: "parameters.GatewayContractProperties.LocationData.City", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.GatewayContractProperties.LocationData.City", Name: validation.MaxLength, Rule: 256, Chain: nil}}}, - {Target: "parameters.GatewayContractProperties.LocationData.District", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.GatewayContractProperties.LocationData.District", Name: validation.MaxLength, Rule: 256, Chain: nil}}}, - {Target: "parameters.GatewayContractProperties.LocationData.CountryOrRegion", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.GatewayContractProperties.LocationData.CountryOrRegion", Name: validation.MaxLength, Rule: 256, Chain: nil}}}, - }}, - {Target: "parameters.GatewayContractProperties.Description", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.GatewayContractProperties.Description", Name: validation.MaxLength, Rule: 1000, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, gatewayID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GatewayClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client GatewayClient) CreateOrUpdateResponder(resp *http.Response) (result GatewayContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes specific Gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client GatewayClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, gatewayID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GatewayClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GatewayClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// GenerateToken gets the Shared Access Authorization Token for the gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -func (client GatewayClient) GenerateToken(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayTokenRequestContract) (result GatewayTokenContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.GenerateToken") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Expiry", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "GenerateToken", err.Error()) - } - - req, err := client.GenerateTokenPreparer(ctx, resourceGroupName, serviceName, gatewayID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "GenerateToken", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateTokenSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "GenerateToken", resp, "Failure sending request") - return - } - - result, err = client.GenerateTokenResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "GenerateToken", resp, "Failure responding to request") - return - } - - return -} - -// GenerateTokenPreparer prepares the GenerateToken request. -func (client GatewayClient) GenerateTokenPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayTokenRequestContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/generateToken", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateTokenSender sends the GenerateToken request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) GenerateTokenSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GenerateTokenResponder handles the response to the GenerateToken request. The method always -// closes the http.Response Body. -func (client GatewayClient) GenerateTokenResponder(resp *http.Response) (result GatewayTokenContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the details of the Gateway specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -func (client GatewayClient) Get(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string) (result GatewayContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, gatewayID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client GatewayClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GatewayClient) GetResponder(resp *http.Response) (result GatewayContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Gateway specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -func (client GatewayClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, gatewayID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client GatewayClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client GatewayClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of gateways registered with service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| region | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client GatewayClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result GatewayCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.ListByService") - defer func() { - sc := -1 - if result.gc.Response.Response != nil { - sc = result.gc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.gc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "ListByService", resp, "Failure sending request") - return - } - - result.gc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "ListByService", resp, "Failure responding to request") - return - } - if result.gc.hasNextLink() && result.gc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client GatewayClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client GatewayClient) ListByServiceResponder(resp *http.Response) (result GatewayCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client GatewayClient) listByServiceNextResults(ctx context.Context, lastResults GatewayCollection) (result GatewayCollection, err error) { - req, err := lastResults.gatewayCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client GatewayClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result GatewayCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// ListKeys retrieves gateway keys. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -func (client GatewayClient) ListKeys(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string) (result GatewayKeysContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.ListKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, serviceName, gatewayID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client GatewayClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client GatewayClient) ListKeysResponder(resp *http.Response) (result GatewayKeysContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerates specified gateway key invalidating any tokens created with it. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -func (client GatewayClient) RegenerateKey(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayKeyRegenerationRequestContract) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.RegenerateKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, serviceName, gatewayID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client GatewayClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayKeyRegenerationRequestContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/regenerateKey", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateKeySender sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client GatewayClient) RegenerateKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates the details of the gateway specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client GatewayClient) Update(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayContract, ifMatch string) (result GatewayContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, gatewayID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client GatewayClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client GatewayClient) UpdateResponder(resp *http.Response) (result GatewayContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gatewayapi.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gatewayapi.go deleted file mode 100644 index 88fca938ff65..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gatewayapi.go +++ /dev/null @@ -1,472 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// GatewayAPIClient is the apiManagement Client -type GatewayAPIClient struct { - BaseClient -} - -// NewGatewayAPIClient creates an instance of the GatewayAPIClient client. -func NewGatewayAPIClient(subscriptionID string) GatewayAPIClient { - return NewGatewayAPIClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGatewayAPIClientWithBaseURI creates an instance of the GatewayAPIClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewGatewayAPIClientWithBaseURI(baseURI string, subscriptionID string) GatewayAPIClient { - return GatewayAPIClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate adds an API to the specified Gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// apiid - API identifier. Must be unique in the current API Management service instance. -func (client GatewayAPIClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, apiid string, parameters *AssociationContract) (result APIContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayAPIClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayAPIClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, gatewayID, apiid, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GatewayAPIClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, apiid string, parameters *AssociationContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayAPIClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client GatewayAPIClient) CreateOrUpdateResponder(resp *http.Response) (result APIContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified API from the specified Gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// apiid - API identifier. Must be unique in the current API Management service instance. -func (client GatewayAPIClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayAPIClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayAPIClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, gatewayID, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GatewayAPIClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayAPIClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GatewayAPIClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetEntityTag checks that API entity specified by identifier is associated with the Gateway entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// apiid - API identifier. Must be unique in the current API Management service instance. -func (client GatewayAPIClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayAPIClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayAPIClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, gatewayID, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client GatewayAPIClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayAPIClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client GatewayAPIClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of the APIs associated with a gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client GatewayAPIClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, filter string, top *int32, skip *int32) (result APICollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayAPIClient.ListByService") - defer func() { - sc := -1 - if result.ac.Response.Response != nil { - sc = result.ac.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayAPIClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, gatewayID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ac.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "ListByService", resp, "Failure sending request") - return - } - - result.ac, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ac.hasNextLink() && result.ac.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client GatewayAPIClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayAPIClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client GatewayAPIClient) ListByServiceResponder(resp *http.Response) (result APICollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client GatewayAPIClient) listByServiceNextResults(ctx context.Context, lastResults APICollection) (result APICollection, err error) { - req, err := lastResults.aPICollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client GatewayAPIClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, filter string, top *int32, skip *int32) (result APICollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayAPIClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, gatewayID, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gatewaycertificateauthority.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gatewaycertificateauthority.go deleted file mode 100644 index ce5c5ff1b425..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gatewaycertificateauthority.go +++ /dev/null @@ -1,580 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// GatewayCertificateAuthorityClient is the apiManagement Client -type GatewayCertificateAuthorityClient struct { - BaseClient -} - -// NewGatewayCertificateAuthorityClient creates an instance of the GatewayCertificateAuthorityClient client. -func NewGatewayCertificateAuthorityClient(subscriptionID string) GatewayCertificateAuthorityClient { - return NewGatewayCertificateAuthorityClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGatewayCertificateAuthorityClientWithBaseURI creates an instance of the GatewayCertificateAuthorityClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewGatewayCertificateAuthorityClientWithBaseURI(baseURI string, subscriptionID string) GatewayCertificateAuthorityClient { - return GatewayCertificateAuthorityClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate assign Certificate entity to Gateway entity as Certificate Authority. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client GatewayCertificateAuthorityClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, certificateID string, parameters GatewayCertificateAuthorityContract, ifMatch string) (result GatewayCertificateAuthorityContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCertificateAuthorityClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayCertificateAuthorityClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, gatewayID, certificateID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GatewayCertificateAuthorityClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, certificateID string, parameters GatewayCertificateAuthorityContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayCertificateAuthorityClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client GatewayCertificateAuthorityClient) CreateOrUpdateResponder(resp *http.Response) (result GatewayCertificateAuthorityContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove relationship between Certificate Authority and Gateway entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client GatewayCertificateAuthorityClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, certificateID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCertificateAuthorityClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayCertificateAuthorityClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, gatewayID, certificateID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GatewayCertificateAuthorityClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, certificateID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayCertificateAuthorityClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GatewayCertificateAuthorityClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get assigned Gateway Certificate Authority details. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -func (client GatewayCertificateAuthorityClient) Get(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, certificateID string) (result GatewayCertificateAuthorityContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCertificateAuthorityClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayCertificateAuthorityClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, gatewayID, certificateID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client GatewayCertificateAuthorityClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, certificateID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayCertificateAuthorityClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GatewayCertificateAuthorityClient) GetResponder(resp *http.Response) (result GatewayCertificateAuthorityContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag checks if Certificate entity is assigned to Gateway entity as Certificate Authority. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -func (client GatewayCertificateAuthorityClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, certificateID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCertificateAuthorityClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayCertificateAuthorityClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, gatewayID, certificateID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client GatewayCertificateAuthorityClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, certificateID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayCertificateAuthorityClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client GatewayCertificateAuthorityClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists the collection of Certificate Authorities for the specified Gateway entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | eq, ne | |
-// top - number of records to return. -// skip - number of records to skip. -func (client GatewayCertificateAuthorityClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, filter string, top *int32, skip *int32) (result GatewayCertificateAuthorityCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCertificateAuthorityClient.ListByService") - defer func() { - sc := -1 - if result.gcac.Response.Response != nil { - sc = result.gcac.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayCertificateAuthorityClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, gatewayID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.gcac.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "ListByService", resp, "Failure sending request") - return - } - - result.gcac, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "ListByService", resp, "Failure responding to request") - return - } - if result.gcac.hasNextLink() && result.gcac.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client GatewayCertificateAuthorityClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayCertificateAuthorityClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client GatewayCertificateAuthorityClient) ListByServiceResponder(resp *http.Response) (result GatewayCertificateAuthorityCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client GatewayCertificateAuthorityClient) listByServiceNextResults(ctx context.Context, lastResults GatewayCertificateAuthorityCollection) (result GatewayCertificateAuthorityCollection, err error) { - req, err := lastResults.gatewayCertificateAuthorityCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayCertificateAuthorityClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client GatewayCertificateAuthorityClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, filter string, top *int32, skip *int32) (result GatewayCertificateAuthorityCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCertificateAuthorityClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, gatewayID, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gatewayhostnameconfiguration.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gatewayhostnameconfiguration.go deleted file mode 100644 index 7c87c48877b3..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/gatewayhostnameconfiguration.go +++ /dev/null @@ -1,574 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// GatewayHostnameConfigurationClient is the apiManagement Client -type GatewayHostnameConfigurationClient struct { - BaseClient -} - -// NewGatewayHostnameConfigurationClient creates an instance of the GatewayHostnameConfigurationClient client. -func NewGatewayHostnameConfigurationClient(subscriptionID string) GatewayHostnameConfigurationClient { - return NewGatewayHostnameConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGatewayHostnameConfigurationClientWithBaseURI creates an instance of the GatewayHostnameConfigurationClient -// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI -// (sovereign clouds, Azure stack). -func NewGatewayHostnameConfigurationClientWithBaseURI(baseURI string, subscriptionID string) GatewayHostnameConfigurationClient { - return GatewayHostnameConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates of updates hostname configuration for a Gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// hcID - gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client GatewayHostnameConfigurationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string, parameters GatewayHostnameConfigurationContract, ifMatch string) (result GatewayHostnameConfigurationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hcID, - Constraints: []validation.Constraint{{Target: "hcID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "hcID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayHostnameConfigurationClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, gatewayID, hcID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GatewayHostnameConfigurationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string, parameters GatewayHostnameConfigurationContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "hcId": autorest.Encode("path", hcID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayHostnameConfigurationClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client GatewayHostnameConfigurationClient) CreateOrUpdateResponder(resp *http.Response) (result GatewayHostnameConfigurationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified hostname configuration from the specified Gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// hcID - gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client GatewayHostnameConfigurationClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hcID, - Constraints: []validation.Constraint{{Target: "hcID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "hcID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayHostnameConfigurationClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, gatewayID, hcID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GatewayHostnameConfigurationClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "hcId": autorest.Encode("path", hcID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayHostnameConfigurationClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GatewayHostnameConfigurationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get details of a hostname configuration -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// hcID - gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. -func (client GatewayHostnameConfigurationClient) Get(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string) (result GatewayHostnameConfigurationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hcID, - Constraints: []validation.Constraint{{Target: "hcID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "hcID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayHostnameConfigurationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, gatewayID, hcID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client GatewayHostnameConfigurationClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "hcId": autorest.Encode("path", hcID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayHostnameConfigurationClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GatewayHostnameConfigurationClient) GetResponder(resp *http.Response) (result GatewayHostnameConfigurationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag checks that hostname configuration entity specified by identifier exists for specified Gateway entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// hcID - gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. -func (client GatewayHostnameConfigurationClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hcID, - Constraints: []validation.Constraint{{Target: "hcID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "hcID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayHostnameConfigurationClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, gatewayID, hcID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client GatewayHostnameConfigurationClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "hcId": autorest.Encode("path", hcID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayHostnameConfigurationClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client GatewayHostnameConfigurationClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists the collection of hostname configurations for the specified gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| hostname | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client GatewayHostnameConfigurationClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, filter string, top *int32, skip *int32) (result GatewayHostnameConfigurationCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationClient.ListByService") - defer func() { - sc := -1 - if result.ghcc.Response.Response != nil { - sc = result.ghcc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayHostnameConfigurationClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, gatewayID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ghcc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "ListByService", resp, "Failure sending request") - return - } - - result.ghcc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ghcc.hasNextLink() && result.ghcc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client GatewayHostnameConfigurationClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayHostnameConfigurationClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client GatewayHostnameConfigurationClient) ListByServiceResponder(resp *http.Response) (result GatewayHostnameConfigurationCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client GatewayHostnameConfigurationClient) listByServiceNextResults(ctx context.Context, lastResults GatewayHostnameConfigurationCollection) (result GatewayHostnameConfigurationCollection, err error) { - req, err := lastResults.gatewayHostnameConfigurationCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client GatewayHostnameConfigurationClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, filter string, top *int32, skip *int32) (result GatewayHostnameConfigurationCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, gatewayID, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/group.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/group.go deleted file mode 100644 index deecc436aa71..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/group.go +++ /dev/null @@ -1,647 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// GroupClient is the apiManagement Client -type GroupClient struct { - BaseClient -} - -// NewGroupClient creates an instance of the GroupClient client. -func NewGroupClient(subscriptionID string) GroupClient { - return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupClientWithBaseURI creates an instance of the GroupClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { - return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a group. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client GroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters, ifMatch string) (result GroupContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.GroupCreateParametersProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.GroupCreateParametersProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.GroupCreateParametersProperties.DisplayName", Name: validation.MaxLength, Rule: 300, Chain: nil}, - {Target: "parameters.GroupCreateParametersProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, groupID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GroupClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result GroupContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes specific group of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client GroupClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, groupID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the group specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -func (client GroupClient) Get(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (result GroupContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupClient) GetResponder(resp *http.Response) (result GroupContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the group specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -func (client GroupClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client GroupClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client GroupClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of groups defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| externalId | filter | eq | |
-// top - number of records to return. -// skip - number of records to skip. -func (client GroupClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result GroupCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.ListByService") - defer func() { - sc := -1 - if result.gc.Response.Response != nil { - sc = result.gc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.gc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "ListByService", resp, "Failure sending request") - return - } - - result.gc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "ListByService", resp, "Failure responding to request") - return - } - if result.gc.hasNextLink() && result.gc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client GroupClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client GroupClient) ListByServiceResponder(resp *http.Response) (result GroupCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client GroupClient) listByServiceNextResults(ctx context.Context, lastResults GroupCollection) (result GroupCollection, err error) { - req, err := lastResults.groupCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.GroupClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.GroupClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client GroupClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result GroupCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates the details of the group specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client GroupClient) Update(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupUpdateParameters, ifMatch string) (result GroupContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, groupID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client GroupClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client GroupClient) UpdateResponder(resp *http.Response) (result GroupContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/groupuser.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/groupuser.go deleted file mode 100644 index bbc5b45da8a9..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/groupuser.go +++ /dev/null @@ -1,467 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// GroupUserClient is the apiManagement Client -type GroupUserClient struct { - BaseClient -} - -// NewGroupUserClient creates an instance of the GroupUserClient client. -func NewGroupUserClient(subscriptionID string) GroupUserClient { - return NewGroupUserClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupUserClientWithBaseURI creates an instance of the GroupUserClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewGroupUserClientWithBaseURI(baseURI string, subscriptionID string) GroupUserClient { - return GroupUserClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckEntityExists checks that user entity specified by identifier is associated with the group entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client GroupUserClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupUserClient.CheckEntityExists") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupUserClient", "CheckEntityExists", err.Error()) - } - - req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, groupID, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckEntityExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "CheckEntityExists", resp, "Failure sending request") - return - } - - result, err = client.CheckEntityExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "CheckEntityExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckEntityExistsPreparer prepares the CheckEntityExists request. -func (client GroupUserClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the -// http.Response Body if it receives an error. -func (client GroupUserClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (client GroupUserClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// Create add existing user to existing group -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client GroupUserClient) Create(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (result UserContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupUserClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupUserClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, serviceName, groupID, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client GroupUserClient) CreatePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client GroupUserClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client GroupUserClient) CreateResponder(resp *http.Response) (result UserContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove existing user from existing group. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client GroupUserClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupUserClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupUserClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, groupID, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GroupUserClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GroupUserClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GroupUserClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// List lists a collection of user entities associated with the group. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| firstName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| lastName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| email | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| registrationDate | filter | ge, le, eq, ne, gt, lt | |
| note -// | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client GroupUserClient) List(ctx context.Context, resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (result UserCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupUserClient.List") - defer func() { - sc := -1 - if result.uc.Response.Response != nil { - sc = result.uc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupUserClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, groupID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.uc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "List", resp, "Failure sending request") - return - } - - result.uc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "List", resp, "Failure responding to request") - return - } - if result.uc.hasNextLink() && result.uc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupUserClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GroupUserClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GroupUserClient) ListResponder(resp *http.Response) (result UserCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client GroupUserClient) listNextResults(ctx context.Context, lastResults UserCollection) (result UserCollection, err error) { - req, err := lastResults.userCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client GroupUserClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (result UserCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupUserClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, serviceName, groupID, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/identityprovider.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/identityprovider.go deleted file mode 100644 index 93c0ce36e587..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/identityprovider.go +++ /dev/null @@ -1,697 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IdentityProviderClient is the apiManagement Client -type IdentityProviderClient struct { - BaseClient -} - -// NewIdentityProviderClient creates an instance of the IdentityProviderClient client. -func NewIdentityProviderClient(subscriptionID string) IdentityProviderClient { - return NewIdentityProviderClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIdentityProviderClientWithBaseURI creates an instance of the IdentityProviderClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewIdentityProviderClientWithBaseURI(baseURI string, subscriptionID string) IdentityProviderClient { - return IdentityProviderClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates the IdentityProvider configuration. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client IdentityProviderClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, parameters IdentityProviderCreateContract, ifMatch string) (result IdentityProviderContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.IdentityProviderCreateContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.IdentityProviderCreateContractProperties.ClientID", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.IdentityProviderCreateContractProperties.ClientID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {Target: "parameters.IdentityProviderCreateContractProperties.ClientSecret", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.IdentityProviderCreateContractProperties.ClientSecret", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, identityProviderName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IdentityProviderClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, parameters IdentityProviderCreateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProviderClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client IdentityProviderClient) CreateOrUpdateResponder(resp *http.Response) (result IdentityProviderContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified identity provider configuration. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client IdentityProviderClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, identityProviderName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IdentityProviderClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProviderClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client IdentityProviderClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the configuration details of the identity Provider configured in specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -func (client IdentityProviderClient) Get(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (result IdentityProviderContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, identityProviderName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IdentityProviderClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProviderClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IdentityProviderClient) GetResponder(resp *http.Response) (result IdentityProviderContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the identityProvider specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -func (client IdentityProviderClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, identityProviderName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client IdentityProviderClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProviderClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client IdentityProviderClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of Identity Provider configured in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client IdentityProviderClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result IdentityProviderListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.ListByService") - defer func() { - sc := -1 - if result.ipl.Response.Response != nil { - sc = result.ipl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ipl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "ListByService", resp, "Failure sending request") - return - } - - result.ipl, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ipl.hasNextLink() && result.ipl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client IdentityProviderClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProviderClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client IdentityProviderClient) ListByServiceResponder(resp *http.Response) (result IdentityProviderList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client IdentityProviderClient) listByServiceNextResults(ctx context.Context, lastResults IdentityProviderList) (result IdentityProviderList, err error) { - req, err := lastResults.identityProviderListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client IdentityProviderClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string) (result IdentityProviderListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName) - return -} - -// ListSecrets gets the client secret details of the Identity Provider. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -func (client IdentityProviderClient) ListSecrets(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (result ClientSecretContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.ListSecrets") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "ListSecrets", err.Error()) - } - - req, err := client.ListSecretsPreparer(ctx, resourceGroupName, serviceName, identityProviderName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "ListSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.ListSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "ListSecrets", resp, "Failure sending request") - return - } - - result, err = client.ListSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "ListSecrets", resp, "Failure responding to request") - return - } - - return -} - -// ListSecretsPreparer prepares the ListSecrets request. -func (client IdentityProviderClient) ListSecretsPreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}/listSecrets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSecretsSender sends the ListSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProviderClient) ListSecretsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSecretsResponder handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (client IdentityProviderClient) ListSecretsResponder(resp *http.Response) (result ClientSecretContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates an existing IdentityProvider configuration. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client IdentityProviderClient) Update(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, parameters IdentityProviderUpdateParameters, ifMatch string) (result IdentityProviderContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, identityProviderName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client IdentityProviderClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, parameters IdentityProviderUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProviderClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client IdentityProviderClient) UpdateResponder(resp *http.Response) (result IdentityProviderContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/issue.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/issue.go deleted file mode 100644 index 403a70c3731c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/issue.go +++ /dev/null @@ -1,272 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IssueClient is the apiManagement Client -type IssueClient struct { - BaseClient -} - -// NewIssueClient creates an instance of the IssueClient client. -func NewIssueClient(subscriptionID string) IssueClient { - return NewIssueClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIssueClientWithBaseURI creates an instance of the IssueClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewIssueClientWithBaseURI(baseURI string, subscriptionID string) IssueClient { - return IssueClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets API Management issue details -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// issueID - issue identifier. Must be unique in the current API Management service instance. -func (client IssueClient) Get(ctx context.Context, resourceGroupName string, serviceName string, issueID string) (result IssueContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IssueClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, issueID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IssueClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, issueID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues/{issueId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IssueClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IssueClient) GetResponder(resp *http.Response) (result IssueContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of issues in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| apiId | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| authorName | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| state | filter | eq | |
-// top - number of records to return. -// skip - number of records to skip. -func (client IssueClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result IssueCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueClient.ListByService") - defer func() { - sc := -1 - if result.ic.Response.Response != nil { - sc = result.ic.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.IssueClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ic.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "ListByService", resp, "Failure sending request") - return - } - - result.ic, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ic.hasNextLink() && result.ic.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client IssueClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client IssueClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client IssueClient) ListByServiceResponder(resp *http.Response) (result IssueCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client IssueClient) listByServiceNextResults(ctx context.Context, lastResults IssueCollection) (result IssueCollection, err error) { - req, err := lastResults.issueCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.IssueClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.IssueClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client IssueClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result IssueCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/logger.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/logger.go deleted file mode 100644 index 8b336a9e1577..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/logger.go +++ /dev/null @@ -1,645 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LoggerClient is the apiManagement Client -type LoggerClient struct { - BaseClient -} - -// NewLoggerClient creates an instance of the LoggerClient client. -func NewLoggerClient(subscriptionID string) LoggerClient { - return NewLoggerClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLoggerClientWithBaseURI creates an instance of the LoggerClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewLoggerClientWithBaseURI(baseURI string, subscriptionID string) LoggerClient { - return LoggerClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a logger. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// loggerID - logger identifier. Must be unique in the API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client LoggerClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters LoggerContract, ifMatch string) (result LoggerContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerID, - Constraints: []validation.Constraint{{Target: "loggerID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LoggerContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LoggerContractProperties.Description", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LoggerContractProperties.Description", Name: validation.MaxLength, Rule: 256, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, loggerID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LoggerClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters LoggerContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerId": autorest.Encode("path", loggerID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client LoggerClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client LoggerClient) CreateOrUpdateResponder(resp *http.Response) (result LoggerContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified logger. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// loggerID - logger identifier. Must be unique in the API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client LoggerClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerID, - Constraints: []validation.Constraint{{Target: "loggerID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, loggerID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LoggerClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerId": autorest.Encode("path", loggerID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client LoggerClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client LoggerClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the logger specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// loggerID - logger identifier. Must be unique in the API Management service instance. -func (client LoggerClient) Get(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (result LoggerContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerID, - Constraints: []validation.Constraint{{Target: "loggerID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, loggerID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LoggerClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerId": autorest.Encode("path", loggerID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client LoggerClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client LoggerClient) GetResponder(resp *http.Response) (result LoggerContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the logger specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// loggerID - logger identifier. Must be unique in the API Management service instance. -func (client LoggerClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerID, - Constraints: []validation.Constraint{{Target: "loggerID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, loggerID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client LoggerClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerId": autorest.Encode("path", loggerID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client LoggerClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client LoggerClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of loggers in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| loggerType | filter | eq | |
| resourceId | -// filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client LoggerClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result LoggerCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.ListByService") - defer func() { - sc := -1 - if result.lc.Response.Response != nil { - sc = result.lc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.lc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "ListByService", resp, "Failure sending request") - return - } - - result.lc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "ListByService", resp, "Failure responding to request") - return - } - if result.lc.hasNextLink() && result.lc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client LoggerClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client LoggerClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client LoggerClient) ListByServiceResponder(resp *http.Response) (result LoggerCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client LoggerClient) listByServiceNextResults(ctx context.Context, lastResults LoggerCollection) (result LoggerCollection, err error) { - req, err := lastResults.loggerCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client LoggerClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result LoggerCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates an existing logger. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// loggerID - logger identifier. Must be unique in the API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client LoggerClient) Update(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters LoggerUpdateContract, ifMatch string) (result LoggerContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerID, - Constraints: []validation.Constraint{{Target: "loggerID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, loggerID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client LoggerClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters LoggerUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerId": autorest.Encode("path", loggerID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client LoggerClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client LoggerClient) UpdateResponder(resp *http.Response) (result LoggerContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/models.go deleted file mode 100644 index 6c579f52454c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/models.go +++ /dev/null @@ -1,17367 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "github.com/gofrs/uuid" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement" - -// AccessInformationCollection paged AccessInformation list representation. -type AccessInformationCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]AccessInformationContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccessInformationCollection. -func (aic AccessInformationCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aic.Count != nil { - objectMap["count"] = aic.Count - } - return json.Marshal(objectMap) -} - -// AccessInformationCollectionIterator provides access to a complete listing of AccessInformationContract -// values. -type AccessInformationCollectionIterator struct { - i int - page AccessInformationCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AccessInformationCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccessInformationCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AccessInformationCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AccessInformationCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AccessInformationCollectionIterator) Response() AccessInformationCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AccessInformationCollectionIterator) Value() AccessInformationContract { - if !iter.page.NotDone() { - return AccessInformationContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AccessInformationCollectionIterator type. -func NewAccessInformationCollectionIterator(page AccessInformationCollectionPage) AccessInformationCollectionIterator { - return AccessInformationCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aic AccessInformationCollection) IsEmpty() bool { - return aic.Value == nil || len(*aic.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aic AccessInformationCollection) hasNextLink() bool { - return aic.NextLink != nil && len(*aic.NextLink) != 0 -} - -// accessInformationCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aic AccessInformationCollection) accessInformationCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !aic.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aic.NextLink))) -} - -// AccessInformationCollectionPage contains a page of AccessInformationContract values. -type AccessInformationCollectionPage struct { - fn func(context.Context, AccessInformationCollection) (AccessInformationCollection, error) - aic AccessInformationCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AccessInformationCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccessInformationCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.aic) - if err != nil { - return err - } - page.aic = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AccessInformationCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AccessInformationCollectionPage) NotDone() bool { - return !page.aic.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AccessInformationCollectionPage) Response() AccessInformationCollection { - return page.aic -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AccessInformationCollectionPage) Values() []AccessInformationContract { - if page.aic.IsEmpty() { - return nil - } - return *page.aic.Value -} - -// Creates a new instance of the AccessInformationCollectionPage type. -func NewAccessInformationCollectionPage(cur AccessInformationCollection, getNextPage func(context.Context, AccessInformationCollection) (AccessInformationCollection, error)) AccessInformationCollectionPage { - return AccessInformationCollectionPage{ - fn: getNextPage, - aic: cur, - } -} - -// AccessInformationContract tenant Settings. -type AccessInformationContract struct { - autorest.Response `json:"-"` - // AccessInformationContractProperties - AccessInformation entity contract properties. - *AccessInformationContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccessInformationContract. -func (aic AccessInformationContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aic.AccessInformationContractProperties != nil { - objectMap["properties"] = aic.AccessInformationContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccessInformationContract struct. -func (aic *AccessInformationContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var accessInformationContractProperties AccessInformationContractProperties - err = json.Unmarshal(*v, &accessInformationContractProperties) - if err != nil { - return err - } - aic.AccessInformationContractProperties = &accessInformationContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - aic.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - aic.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - aic.Type = &typeVar - } - } - } - - return nil -} - -// AccessInformationContractProperties tenant access information contract of the API Management service. -type AccessInformationContractProperties struct { - // ID - Access Information type ('access' or 'gitAccess') - ID *string `json:"id,omitempty"` - // PrincipalID - Principal (User) Identifier. - PrincipalID *string `json:"principalId,omitempty"` - // Enabled - Determines whether direct access is enabled. - Enabled *bool `json:"enabled,omitempty"` -} - -// AccessInformationCreateParameterProperties tenant access information update parameters of the API -// Management service -type AccessInformationCreateParameterProperties struct { - // PrincipalID - Principal (User) Identifier. - PrincipalID *string `json:"principalId,omitempty"` - // PrimaryKey - Primary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Secondary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // Enabled - Determines whether direct access is enabled. - Enabled *bool `json:"enabled,omitempty"` -} - -// AccessInformationCreateParameters tenant access information update parameters. -type AccessInformationCreateParameters struct { - // AccessInformationCreateParameterProperties - Tenant access information update parameter properties. - *AccessInformationCreateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccessInformationCreateParameters. -func (aicp AccessInformationCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aicp.AccessInformationCreateParameterProperties != nil { - objectMap["properties"] = aicp.AccessInformationCreateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccessInformationCreateParameters struct. -func (aicp *AccessInformationCreateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var accessInformationCreateParameterProperties AccessInformationCreateParameterProperties - err = json.Unmarshal(*v, &accessInformationCreateParameterProperties) - if err != nil { - return err - } - aicp.AccessInformationCreateParameterProperties = &accessInformationCreateParameterProperties - } - } - } - - return nil -} - -// AccessInformationSecretsContract tenant access information contract of the API Management service. -type AccessInformationSecretsContract struct { - autorest.Response `json:"-"` - // ID - Access Information type ('access' or 'gitAccess') - ID *string `json:"id,omitempty"` - // PrincipalID - Principal (User) Identifier. - PrincipalID *string `json:"principalId,omitempty"` - // PrimaryKey - Primary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Secondary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // Enabled - Determines whether direct access is enabled. - Enabled *bool `json:"enabled,omitempty"` -} - -// AccessInformationUpdateParameterProperties tenant access information update parameters of the API -// Management service -type AccessInformationUpdateParameterProperties struct { - // Enabled - Determines whether direct access is enabled. - Enabled *bool `json:"enabled,omitempty"` -} - -// AccessInformationUpdateParameters tenant access information update parameters. -type AccessInformationUpdateParameters struct { - // AccessInformationUpdateParameterProperties - Tenant access information update parameter properties. - *AccessInformationUpdateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccessInformationUpdateParameters. -func (aiup AccessInformationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aiup.AccessInformationUpdateParameterProperties != nil { - objectMap["properties"] = aiup.AccessInformationUpdateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccessInformationUpdateParameters struct. -func (aiup *AccessInformationUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var accessInformationUpdateParameterProperties AccessInformationUpdateParameterProperties - err = json.Unmarshal(*v, &accessInformationUpdateParameterProperties) - if err != nil { - return err - } - aiup.AccessInformationUpdateParameterProperties = &accessInformationUpdateParameterProperties - } - } - } - - return nil -} - -// AdditionalLocation description of an additional API Management resource location. -type AdditionalLocation struct { - // Location - The location name of the additional region among Azure Data center regions. - Location *string `json:"location,omitempty"` - // Sku - SKU properties of the API Management service. - Sku *ServiceSkuProperties `json:"sku,omitempty"` - // Zones - A list of availability zones denoting where the resource needs to come from. - Zones *[]string `json:"zones,omitempty"` - // PublicIPAddresses - READ-ONLY; Public Static Load Balanced IP addresses of the API Management service in the additional location. Available only for Basic, Standard, Premium and Isolated SKU. - PublicIPAddresses *[]string `json:"publicIPAddresses,omitempty"` - // PrivateIPAddresses - READ-ONLY; Private Static Load Balanced IP addresses of the API Management service which is deployed in an Internal Virtual Network in a particular additional location. Available only for Basic, Standard, Premium and Isolated SKU. - PrivateIPAddresses *[]string `json:"privateIPAddresses,omitempty"` - // PublicIPAddressID - Public Standard SKU IP V4 based IP address to be associated with Virtual Network deployed service in the location. Supported only for Premium SKU being deployed in Virtual Network. - PublicIPAddressID *string `json:"publicIpAddressId,omitempty"` - // VirtualNetworkConfiguration - Virtual network configuration for the location. - VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` - // GatewayRegionalURL - READ-ONLY; Gateway URL of the API Management service in the Region. - GatewayRegionalURL *string `json:"gatewayRegionalUrl,omitempty"` - // DisableGateway - Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in this additional location. - DisableGateway *bool `json:"disableGateway,omitempty"` - // PlatformVersion - READ-ONLY; Compute Platform Version running the service. Possible values include: 'PlatformVersionUndetermined', 'PlatformVersionStv1', 'PlatformVersionStv2', 'PlatformVersionMtv1' - PlatformVersion PlatformVersion `json:"platformVersion,omitempty"` -} - -// MarshalJSON is the custom marshaler for AdditionalLocation. -func (al AdditionalLocation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if al.Location != nil { - objectMap["location"] = al.Location - } - if al.Sku != nil { - objectMap["sku"] = al.Sku - } - if al.Zones != nil { - objectMap["zones"] = al.Zones - } - if al.PublicIPAddressID != nil { - objectMap["publicIpAddressId"] = al.PublicIPAddressID - } - if al.VirtualNetworkConfiguration != nil { - objectMap["virtualNetworkConfiguration"] = al.VirtualNetworkConfiguration - } - if al.DisableGateway != nil { - objectMap["disableGateway"] = al.DisableGateway - } - return json.Marshal(objectMap) -} - -// APICollection paged API list representation. -type APICollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]APIContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for APICollection. -func (ac APICollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ac.Count != nil { - objectMap["count"] = ac.Count - } - return json.Marshal(objectMap) -} - -// APICollectionIterator provides access to a complete listing of APIContract values. -type APICollectionIterator struct { - i int - page APICollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *APICollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APICollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *APICollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APICollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter APICollectionIterator) Response() APICollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter APICollectionIterator) Value() APIContract { - if !iter.page.NotDone() { - return APIContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APICollectionIterator type. -func NewAPICollectionIterator(page APICollectionPage) APICollectionIterator { - return APICollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ac APICollection) IsEmpty() bool { - return ac.Value == nil || len(*ac.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ac APICollection) hasNextLink() bool { - return ac.NextLink != nil && len(*ac.NextLink) != 0 -} - -// aPICollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ac APICollection) aPICollectionPreparer(ctx context.Context) (*http.Request, error) { - if !ac.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ac.NextLink))) -} - -// APICollectionPage contains a page of APIContract values. -type APICollectionPage struct { - fn func(context.Context, APICollection) (APICollection, error) - ac APICollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *APICollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APICollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ac) - if err != nil { - return err - } - page.ac = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *APICollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APICollectionPage) NotDone() bool { - return !page.ac.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APICollectionPage) Response() APICollection { - return page.ac -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APICollectionPage) Values() []APIContract { - if page.ac.IsEmpty() { - return nil - } - return *page.ac.Value -} - -// Creates a new instance of the APICollectionPage type. -func NewAPICollectionPage(cur APICollection, getNextPage func(context.Context, APICollection) (APICollection, error)) APICollectionPage { - return APICollectionPage{ - fn: getNextPage, - ac: cur, - } -} - -// APIContactInformation API contact information -type APIContactInformation struct { - // Name - The identifying name of the contact person/organization - Name *string `json:"name,omitempty"` - // URL - The URL pointing to the contact information. MUST be in the format of a URL - URL *string `json:"url,omitempty"` - // Email - The email address of the contact person/organization. MUST be in the format of an email address - Email *string `json:"email,omitempty"` -} - -// APIContract API details. -type APIContract struct { - autorest.Response `json:"-"` - // APIContractProperties - API entity contract properties. - *APIContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIContract. -func (ac APIContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ac.APIContractProperties != nil { - objectMap["properties"] = ac.APIContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APIContract struct. -func (ac *APIContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var APIContractProperties APIContractProperties - err = json.Unmarshal(*v, &APIContractProperties) - if err != nil { - return err - } - ac.APIContractProperties = &APIContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ac.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ac.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ac.Type = &typeVar - } - } - } - - return nil -} - -// APIContractProperties API Entity Properties -type APIContractProperties struct { - // SourceAPIID - API identifier of the source API. - SourceAPIID *string `json:"sourceApiId,omitempty"` - // DisplayName - API name. Must be 1 to 300 characters long. - DisplayName *string `json:"displayName,omitempty"` - // ServiceURL - Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. - ServiceURL *string `json:"serviceUrl,omitempty"` - // Path - Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - Path *string `json:"path,omitempty"` - // Protocols - Describes on which protocols the operations in this API can be invoked. - Protocols *[]Protocol `json:"protocols,omitempty"` - // APIVersionSet - Version set details - APIVersionSet *APIVersionSetContractDetails `json:"apiVersionSet,omitempty"` - // Description - Description of the API. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthenticationSettings - Collection of authentication settings included into this API. - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - // SubscriptionKeyParameterNames - Protocols over which API is made available. - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - // APIType - Type of API. Possible values include: 'APITypeHTTP', 'APITypeSoap', 'APITypeWebsocket', 'APITypeGraphql' - APIType APIType `json:"type,omitempty"` - // APIRevision - Describes the revision of the API. If no value is provided, default revision 1 is created - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - Indicates the version identifier of the API if the API is versioned - APIVersion *string `json:"apiVersion,omitempty"` - // IsCurrent - Indicates if API revision is current api revision. - IsCurrent *bool `json:"isCurrent,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsOnline *bool `json:"isOnline,omitempty"` - // APIRevisionDescription - Description of the API Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionDescription - Description of the API Version. - APIVersionDescription *string `json:"apiVersionDescription,omitempty"` - // APIVersionSetID - A resource identifier for the related ApiVersionSet. - APIVersionSetID *string `json:"apiVersionSetId,omitempty"` - // SubscriptionRequired - Specifies whether an API or Product subscription is required for accessing the API. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // TermsOfServiceURL - A URL to the Terms of Service for the API. MUST be in the format of a URL. - TermsOfServiceURL *string `json:"termsOfServiceUrl,omitempty"` - // Contact - Contact information for the API. - Contact *APIContactInformation `json:"contact,omitempty"` - // License - License information for the API. - License *APILicenseInformation `json:"license,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIContractProperties. -func (acp APIContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acp.SourceAPIID != nil { - objectMap["sourceApiId"] = acp.SourceAPIID - } - if acp.DisplayName != nil { - objectMap["displayName"] = acp.DisplayName - } - if acp.ServiceURL != nil { - objectMap["serviceUrl"] = acp.ServiceURL - } - if acp.Path != nil { - objectMap["path"] = acp.Path - } - if acp.Protocols != nil { - objectMap["protocols"] = acp.Protocols - } - if acp.APIVersionSet != nil { - objectMap["apiVersionSet"] = acp.APIVersionSet - } - if acp.Description != nil { - objectMap["description"] = acp.Description - } - if acp.AuthenticationSettings != nil { - objectMap["authenticationSettings"] = acp.AuthenticationSettings - } - if acp.SubscriptionKeyParameterNames != nil { - objectMap["subscriptionKeyParameterNames"] = acp.SubscriptionKeyParameterNames - } - if acp.APIType != "" { - objectMap["type"] = acp.APIType - } - if acp.APIRevision != nil { - objectMap["apiRevision"] = acp.APIRevision - } - if acp.APIVersion != nil { - objectMap["apiVersion"] = acp.APIVersion - } - if acp.IsCurrent != nil { - objectMap["isCurrent"] = acp.IsCurrent - } - if acp.APIRevisionDescription != nil { - objectMap["apiRevisionDescription"] = acp.APIRevisionDescription - } - if acp.APIVersionDescription != nil { - objectMap["apiVersionDescription"] = acp.APIVersionDescription - } - if acp.APIVersionSetID != nil { - objectMap["apiVersionSetId"] = acp.APIVersionSetID - } - if acp.SubscriptionRequired != nil { - objectMap["subscriptionRequired"] = acp.SubscriptionRequired - } - if acp.TermsOfServiceURL != nil { - objectMap["termsOfServiceUrl"] = acp.TermsOfServiceURL - } - if acp.Contact != nil { - objectMap["contact"] = acp.Contact - } - if acp.License != nil { - objectMap["license"] = acp.License - } - return json.Marshal(objectMap) -} - -// APIContractUpdateProperties API update contract properties. -type APIContractUpdateProperties struct { - // DisplayName - API name. - DisplayName *string `json:"displayName,omitempty"` - // ServiceURL - Absolute URL of the backend service implementing this API. - ServiceURL *string `json:"serviceUrl,omitempty"` - // Path - Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - Path *string `json:"path,omitempty"` - // Protocols - Describes on which protocols the operations in this API can be invoked. - Protocols *[]Protocol `json:"protocols,omitempty"` - // Description - Description of the API. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthenticationSettings - Collection of authentication settings included into this API. - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - // SubscriptionKeyParameterNames - Protocols over which API is made available. - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - // APIType - Type of API. Possible values include: 'APITypeHTTP', 'APITypeSoap', 'APITypeWebsocket', 'APITypeGraphql' - APIType APIType `json:"type,omitempty"` - // APIRevision - Describes the revision of the API. If no value is provided, default revision 1 is created - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - Indicates the version identifier of the API if the API is versioned - APIVersion *string `json:"apiVersion,omitempty"` - // IsCurrent - Indicates if API revision is current api revision. - IsCurrent *bool `json:"isCurrent,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsOnline *bool `json:"isOnline,omitempty"` - // APIRevisionDescription - Description of the API Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionDescription - Description of the API Version. - APIVersionDescription *string `json:"apiVersionDescription,omitempty"` - // APIVersionSetID - A resource identifier for the related ApiVersionSet. - APIVersionSetID *string `json:"apiVersionSetId,omitempty"` - // SubscriptionRequired - Specifies whether an API or Product subscription is required for accessing the API. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // TermsOfServiceURL - A URL to the Terms of Service for the API. MUST be in the format of a URL. - TermsOfServiceURL *string `json:"termsOfServiceUrl,omitempty"` - // Contact - Contact information for the API. - Contact *APIContactInformation `json:"contact,omitempty"` - // License - License information for the API. - License *APILicenseInformation `json:"license,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIContractUpdateProperties. -func (acup APIContractUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acup.DisplayName != nil { - objectMap["displayName"] = acup.DisplayName - } - if acup.ServiceURL != nil { - objectMap["serviceUrl"] = acup.ServiceURL - } - if acup.Path != nil { - objectMap["path"] = acup.Path - } - if acup.Protocols != nil { - objectMap["protocols"] = acup.Protocols - } - if acup.Description != nil { - objectMap["description"] = acup.Description - } - if acup.AuthenticationSettings != nil { - objectMap["authenticationSettings"] = acup.AuthenticationSettings - } - if acup.SubscriptionKeyParameterNames != nil { - objectMap["subscriptionKeyParameterNames"] = acup.SubscriptionKeyParameterNames - } - if acup.APIType != "" { - objectMap["type"] = acup.APIType - } - if acup.APIRevision != nil { - objectMap["apiRevision"] = acup.APIRevision - } - if acup.APIVersion != nil { - objectMap["apiVersion"] = acup.APIVersion - } - if acup.IsCurrent != nil { - objectMap["isCurrent"] = acup.IsCurrent - } - if acup.APIRevisionDescription != nil { - objectMap["apiRevisionDescription"] = acup.APIRevisionDescription - } - if acup.APIVersionDescription != nil { - objectMap["apiVersionDescription"] = acup.APIVersionDescription - } - if acup.APIVersionSetID != nil { - objectMap["apiVersionSetId"] = acup.APIVersionSetID - } - if acup.SubscriptionRequired != nil { - objectMap["subscriptionRequired"] = acup.SubscriptionRequired - } - if acup.TermsOfServiceURL != nil { - objectMap["termsOfServiceUrl"] = acup.TermsOfServiceURL - } - if acup.Contact != nil { - objectMap["contact"] = acup.Contact - } - if acup.License != nil { - objectMap["license"] = acup.License - } - return json.Marshal(objectMap) -} - -// APICreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type APICreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(APIClient) (APIContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *APICreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for APICreateOrUpdateFuture.Result. -func (future *APICreateOrUpdateFuture) result(client APIClient) (ac APIContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APICreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ac.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.APICreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ac.Response.Response, err = future.GetResult(sender); err == nil && ac.Response.Response.StatusCode != http.StatusNoContent { - ac, err = client.CreateOrUpdateResponder(ac.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APICreateOrUpdateFuture", "Result", ac.Response.Response, "Failure responding to request") - } - } - return -} - -// APICreateOrUpdateParameter API Create or Update Parameters. -type APICreateOrUpdateParameter struct { - // APICreateOrUpdateProperties - API entity create of update properties. - *APICreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for APICreateOrUpdateParameter. -func (acoup APICreateOrUpdateParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acoup.APICreateOrUpdateProperties != nil { - objectMap["properties"] = acoup.APICreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APICreateOrUpdateParameter struct. -func (acoup *APICreateOrUpdateParameter) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var APICreateOrUpdateProperties APICreateOrUpdateProperties - err = json.Unmarshal(*v, &APICreateOrUpdateProperties) - if err != nil { - return err - } - acoup.APICreateOrUpdateProperties = &APICreateOrUpdateProperties - } - } - } - - return nil -} - -// APICreateOrUpdateProperties API Create or Update Properties. -type APICreateOrUpdateProperties struct { - // Value - Content value when Importing an API. - Value *string `json:"value,omitempty"` - // Format - Format of the Content in which the API is getting imported. Possible values include: 'ContentFormatWadlXML', 'ContentFormatWadlLinkJSON', 'ContentFormatSwaggerJSON', 'ContentFormatSwaggerLinkJSON', 'ContentFormatWsdl', 'ContentFormatWsdlLink', 'ContentFormatOpenapi', 'ContentFormatOpenapijson', 'ContentFormatOpenapiLink', 'ContentFormatOpenapijsonLink', 'ContentFormatGraphqlLink' - Format ContentFormat `json:"format,omitempty"` - // WsdlSelector - Criteria to limit import of WSDL to a subset of the document. - WsdlSelector *APICreateOrUpdatePropertiesWsdlSelector `json:"wsdlSelector,omitempty"` - // SoapAPIType - Type of API to create. - // * `http` creates a REST API - // * `soap` creates a SOAP pass-through API - // * `websocket` creates websocket API - // * `graphql` creates GraphQL API. Possible values include: 'SoapAPITypeSoapToRest', 'SoapAPITypeSoapPassThrough', 'SoapAPITypeWebSocket', 'SoapAPITypeGraphQL' - SoapAPIType SoapAPIType `json:"apiType,omitempty"` - // SourceAPIID - API identifier of the source API. - SourceAPIID *string `json:"sourceApiId,omitempty"` - // DisplayName - API name. Must be 1 to 300 characters long. - DisplayName *string `json:"displayName,omitempty"` - // ServiceURL - Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. - ServiceURL *string `json:"serviceUrl,omitempty"` - // Path - Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - Path *string `json:"path,omitempty"` - // Protocols - Describes on which protocols the operations in this API can be invoked. - Protocols *[]Protocol `json:"protocols,omitempty"` - // APIVersionSet - Version set details - APIVersionSet *APIVersionSetContractDetails `json:"apiVersionSet,omitempty"` - // Description - Description of the API. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthenticationSettings - Collection of authentication settings included into this API. - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - // SubscriptionKeyParameterNames - Protocols over which API is made available. - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - // APIType - Type of API. Possible values include: 'APITypeHTTP', 'APITypeSoap', 'APITypeWebsocket', 'APITypeGraphql' - APIType APIType `json:"type,omitempty"` - // APIRevision - Describes the revision of the API. If no value is provided, default revision 1 is created - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - Indicates the version identifier of the API if the API is versioned - APIVersion *string `json:"apiVersion,omitempty"` - // IsCurrent - Indicates if API revision is current api revision. - IsCurrent *bool `json:"isCurrent,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsOnline *bool `json:"isOnline,omitempty"` - // APIRevisionDescription - Description of the API Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionDescription - Description of the API Version. - APIVersionDescription *string `json:"apiVersionDescription,omitempty"` - // APIVersionSetID - A resource identifier for the related ApiVersionSet. - APIVersionSetID *string `json:"apiVersionSetId,omitempty"` - // SubscriptionRequired - Specifies whether an API or Product subscription is required for accessing the API. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // TermsOfServiceURL - A URL to the Terms of Service for the API. MUST be in the format of a URL. - TermsOfServiceURL *string `json:"termsOfServiceUrl,omitempty"` - // Contact - Contact information for the API. - Contact *APIContactInformation `json:"contact,omitempty"` - // License - License information for the API. - License *APILicenseInformation `json:"license,omitempty"` -} - -// MarshalJSON is the custom marshaler for APICreateOrUpdateProperties. -func (acoup APICreateOrUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acoup.Value != nil { - objectMap["value"] = acoup.Value - } - if acoup.Format != "" { - objectMap["format"] = acoup.Format - } - if acoup.WsdlSelector != nil { - objectMap["wsdlSelector"] = acoup.WsdlSelector - } - if acoup.SoapAPIType != "" { - objectMap["apiType"] = acoup.SoapAPIType - } - if acoup.SourceAPIID != nil { - objectMap["sourceApiId"] = acoup.SourceAPIID - } - if acoup.DisplayName != nil { - objectMap["displayName"] = acoup.DisplayName - } - if acoup.ServiceURL != nil { - objectMap["serviceUrl"] = acoup.ServiceURL - } - if acoup.Path != nil { - objectMap["path"] = acoup.Path - } - if acoup.Protocols != nil { - objectMap["protocols"] = acoup.Protocols - } - if acoup.APIVersionSet != nil { - objectMap["apiVersionSet"] = acoup.APIVersionSet - } - if acoup.Description != nil { - objectMap["description"] = acoup.Description - } - if acoup.AuthenticationSettings != nil { - objectMap["authenticationSettings"] = acoup.AuthenticationSettings - } - if acoup.SubscriptionKeyParameterNames != nil { - objectMap["subscriptionKeyParameterNames"] = acoup.SubscriptionKeyParameterNames - } - if acoup.APIType != "" { - objectMap["type"] = acoup.APIType - } - if acoup.APIRevision != nil { - objectMap["apiRevision"] = acoup.APIRevision - } - if acoup.APIVersion != nil { - objectMap["apiVersion"] = acoup.APIVersion - } - if acoup.IsCurrent != nil { - objectMap["isCurrent"] = acoup.IsCurrent - } - if acoup.APIRevisionDescription != nil { - objectMap["apiRevisionDescription"] = acoup.APIRevisionDescription - } - if acoup.APIVersionDescription != nil { - objectMap["apiVersionDescription"] = acoup.APIVersionDescription - } - if acoup.APIVersionSetID != nil { - objectMap["apiVersionSetId"] = acoup.APIVersionSetID - } - if acoup.SubscriptionRequired != nil { - objectMap["subscriptionRequired"] = acoup.SubscriptionRequired - } - if acoup.TermsOfServiceURL != nil { - objectMap["termsOfServiceUrl"] = acoup.TermsOfServiceURL - } - if acoup.Contact != nil { - objectMap["contact"] = acoup.Contact - } - if acoup.License != nil { - objectMap["license"] = acoup.License - } - return json.Marshal(objectMap) -} - -// APICreateOrUpdatePropertiesWsdlSelector criteria to limit import of WSDL to a subset of the document. -type APICreateOrUpdatePropertiesWsdlSelector struct { - // WsdlServiceName - Name of service to import from WSDL - WsdlServiceName *string `json:"wsdlServiceName,omitempty"` - // WsdlEndpointName - Name of endpoint(port) to import from WSDL - WsdlEndpointName *string `json:"wsdlEndpointName,omitempty"` -} - -// APIEntityBaseContract API base contract details. -type APIEntityBaseContract struct { - // Description - Description of the API. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthenticationSettings - Collection of authentication settings included into this API. - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - // SubscriptionKeyParameterNames - Protocols over which API is made available. - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - // APIType - Type of API. Possible values include: 'APITypeHTTP', 'APITypeSoap', 'APITypeWebsocket', 'APITypeGraphql' - APIType APIType `json:"type,omitempty"` - // APIRevision - Describes the revision of the API. If no value is provided, default revision 1 is created - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - Indicates the version identifier of the API if the API is versioned - APIVersion *string `json:"apiVersion,omitempty"` - // IsCurrent - Indicates if API revision is current api revision. - IsCurrent *bool `json:"isCurrent,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsOnline *bool `json:"isOnline,omitempty"` - // APIRevisionDescription - Description of the API Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionDescription - Description of the API Version. - APIVersionDescription *string `json:"apiVersionDescription,omitempty"` - // APIVersionSetID - A resource identifier for the related ApiVersionSet. - APIVersionSetID *string `json:"apiVersionSetId,omitempty"` - // SubscriptionRequired - Specifies whether an API or Product subscription is required for accessing the API. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // TermsOfServiceURL - A URL to the Terms of Service for the API. MUST be in the format of a URL. - TermsOfServiceURL *string `json:"termsOfServiceUrl,omitempty"` - // Contact - Contact information for the API. - Contact *APIContactInformation `json:"contact,omitempty"` - // License - License information for the API. - License *APILicenseInformation `json:"license,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIEntityBaseContract. -func (aebc APIEntityBaseContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aebc.Description != nil { - objectMap["description"] = aebc.Description - } - if aebc.AuthenticationSettings != nil { - objectMap["authenticationSettings"] = aebc.AuthenticationSettings - } - if aebc.SubscriptionKeyParameterNames != nil { - objectMap["subscriptionKeyParameterNames"] = aebc.SubscriptionKeyParameterNames - } - if aebc.APIType != "" { - objectMap["type"] = aebc.APIType - } - if aebc.APIRevision != nil { - objectMap["apiRevision"] = aebc.APIRevision - } - if aebc.APIVersion != nil { - objectMap["apiVersion"] = aebc.APIVersion - } - if aebc.IsCurrent != nil { - objectMap["isCurrent"] = aebc.IsCurrent - } - if aebc.APIRevisionDescription != nil { - objectMap["apiRevisionDescription"] = aebc.APIRevisionDescription - } - if aebc.APIVersionDescription != nil { - objectMap["apiVersionDescription"] = aebc.APIVersionDescription - } - if aebc.APIVersionSetID != nil { - objectMap["apiVersionSetId"] = aebc.APIVersionSetID - } - if aebc.SubscriptionRequired != nil { - objectMap["subscriptionRequired"] = aebc.SubscriptionRequired - } - if aebc.TermsOfServiceURL != nil { - objectMap["termsOfServiceUrl"] = aebc.TermsOfServiceURL - } - if aebc.Contact != nil { - objectMap["contact"] = aebc.Contact - } - if aebc.License != nil { - objectMap["license"] = aebc.License - } - return json.Marshal(objectMap) -} - -// APIExportResult API Export result. -type APIExportResult struct { - autorest.Response `json:"-"` - // ID - ResourceId of the API which was exported. - ID *string `json:"id,omitempty"` - // ExportResultFormat - Format in which the API Details are exported to the Storage Blob with Sas Key valid for 5 minutes. Possible values include: 'ExportResultFormatSwagger', 'ExportResultFormatWsdl', 'ExportResultFormatWadl', 'ExportResultFormatOpenAPI' - ExportResultFormat ExportResultFormat `json:"format,omitempty"` - // Value - The object defining the schema of the exported API Detail - Value *APIExportResultValue `json:"value,omitempty"` -} - -// APIExportResultValue the object defining the schema of the exported API Detail -type APIExportResultValue struct { - // Link - Link to the Storage Blob containing the result of the export operation. The Blob Uri is only valid for 5 minutes. - Link *string `json:"link,omitempty"` -} - -// APILicenseInformation API license information -type APILicenseInformation struct { - // Name - The license name used for the API - Name *string `json:"name,omitempty"` - // URL - A URL to the license used for the API. MUST be in the format of a URL - URL *string `json:"url,omitempty"` -} - -// ApimResource the Resource definition. -type ApimResource struct { - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type for API Management resource is set to Microsoft.ApiManagement. - Type *string `json:"type,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ApimResource. -func (ar ApimResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Tags != nil { - objectMap["tags"] = ar.Tags - } - return json.Marshal(objectMap) -} - -// APIReleaseCollection paged ApiRelease list representation. -type APIReleaseCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]APIReleaseContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIReleaseCollection. -func (arc APIReleaseCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arc.Count != nil { - objectMap["count"] = arc.Count - } - return json.Marshal(objectMap) -} - -// APIReleaseCollectionIterator provides access to a complete listing of APIReleaseContract values. -type APIReleaseCollectionIterator struct { - i int - page APIReleaseCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *APIReleaseCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *APIReleaseCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APIReleaseCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter APIReleaseCollectionIterator) Response() APIReleaseCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter APIReleaseCollectionIterator) Value() APIReleaseContract { - if !iter.page.NotDone() { - return APIReleaseContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APIReleaseCollectionIterator type. -func NewAPIReleaseCollectionIterator(page APIReleaseCollectionPage) APIReleaseCollectionIterator { - return APIReleaseCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (arc APIReleaseCollection) IsEmpty() bool { - return arc.Value == nil || len(*arc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (arc APIReleaseCollection) hasNextLink() bool { - return arc.NextLink != nil && len(*arc.NextLink) != 0 -} - -// aPIReleaseCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (arc APIReleaseCollection) aPIReleaseCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !arc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(arc.NextLink))) -} - -// APIReleaseCollectionPage contains a page of APIReleaseContract values. -type APIReleaseCollectionPage struct { - fn func(context.Context, APIReleaseCollection) (APIReleaseCollection, error) - arc APIReleaseCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *APIReleaseCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.arc) - if err != nil { - return err - } - page.arc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *APIReleaseCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APIReleaseCollectionPage) NotDone() bool { - return !page.arc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APIReleaseCollectionPage) Response() APIReleaseCollection { - return page.arc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APIReleaseCollectionPage) Values() []APIReleaseContract { - if page.arc.IsEmpty() { - return nil - } - return *page.arc.Value -} - -// Creates a new instance of the APIReleaseCollectionPage type. -func NewAPIReleaseCollectionPage(cur APIReleaseCollection, getNextPage func(context.Context, APIReleaseCollection) (APIReleaseCollection, error)) APIReleaseCollectionPage { - return APIReleaseCollectionPage{ - fn: getNextPage, - arc: cur, - } -} - -// APIReleaseContract apiRelease details. -type APIReleaseContract struct { - autorest.Response `json:"-"` - // APIReleaseContractProperties - ApiRelease entity contract properties. - *APIReleaseContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIReleaseContract. -func (arc APIReleaseContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arc.APIReleaseContractProperties != nil { - objectMap["properties"] = arc.APIReleaseContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APIReleaseContract struct. -func (arc *APIReleaseContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var APIReleaseContractProperties APIReleaseContractProperties - err = json.Unmarshal(*v, &APIReleaseContractProperties) - if err != nil { - return err - } - arc.APIReleaseContractProperties = &APIReleaseContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - arc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - arc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - arc.Type = &typeVar - } - } - } - - return nil -} - -// APIReleaseContractProperties API Release details -type APIReleaseContractProperties struct { - // APIID - Identifier of the API the release belongs to. - APIID *string `json:"apiId,omitempty"` - // CreatedDateTime - READ-ONLY; The time the API was released. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` - // UpdatedDateTime - READ-ONLY; The time the API release was updated. - UpdatedDateTime *date.Time `json:"updatedDateTime,omitempty"` - // Notes - Release Notes - Notes *string `json:"notes,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIReleaseContractProperties. -func (arcp APIReleaseContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arcp.APIID != nil { - objectMap["apiId"] = arcp.APIID - } - if arcp.Notes != nil { - objectMap["notes"] = arcp.Notes - } - return json.Marshal(objectMap) -} - -// APIRevisionCollection paged API Revision list representation. -type APIRevisionCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]APIRevisionContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIRevisionCollection. -func (arc APIRevisionCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arc.Count != nil { - objectMap["count"] = arc.Count - } - return json.Marshal(objectMap) -} - -// APIRevisionCollectionIterator provides access to a complete listing of APIRevisionContract values. -type APIRevisionCollectionIterator struct { - i int - page APIRevisionCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *APIRevisionCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIRevisionCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *APIRevisionCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APIRevisionCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter APIRevisionCollectionIterator) Response() APIRevisionCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter APIRevisionCollectionIterator) Value() APIRevisionContract { - if !iter.page.NotDone() { - return APIRevisionContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APIRevisionCollectionIterator type. -func NewAPIRevisionCollectionIterator(page APIRevisionCollectionPage) APIRevisionCollectionIterator { - return APIRevisionCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (arc APIRevisionCollection) IsEmpty() bool { - return arc.Value == nil || len(*arc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (arc APIRevisionCollection) hasNextLink() bool { - return arc.NextLink != nil && len(*arc.NextLink) != 0 -} - -// aPIRevisionCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (arc APIRevisionCollection) aPIRevisionCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !arc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(arc.NextLink))) -} - -// APIRevisionCollectionPage contains a page of APIRevisionContract values. -type APIRevisionCollectionPage struct { - fn func(context.Context, APIRevisionCollection) (APIRevisionCollection, error) - arc APIRevisionCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *APIRevisionCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIRevisionCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.arc) - if err != nil { - return err - } - page.arc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *APIRevisionCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APIRevisionCollectionPage) NotDone() bool { - return !page.arc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APIRevisionCollectionPage) Response() APIRevisionCollection { - return page.arc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APIRevisionCollectionPage) Values() []APIRevisionContract { - if page.arc.IsEmpty() { - return nil - } - return *page.arc.Value -} - -// Creates a new instance of the APIRevisionCollectionPage type. -func NewAPIRevisionCollectionPage(cur APIRevisionCollection, getNextPage func(context.Context, APIRevisionCollection) (APIRevisionCollection, error)) APIRevisionCollectionPage { - return APIRevisionCollectionPage{ - fn: getNextPage, - arc: cur, - } -} - -// APIRevisionContract summary of revision metadata. -type APIRevisionContract struct { - // APIID - READ-ONLY; Identifier of the API Revision. - APIID *string `json:"apiId,omitempty"` - // APIRevision - READ-ONLY; Revision number of API. - APIRevision *string `json:"apiRevision,omitempty"` - // CreatedDateTime - READ-ONLY; The time the API Revision was created. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` - // UpdatedDateTime - READ-ONLY; The time the API Revision were updated. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - UpdatedDateTime *date.Time `json:"updatedDateTime,omitempty"` - // Description - READ-ONLY; Description of the API Revision. - Description *string `json:"description,omitempty"` - // PrivateURL - READ-ONLY; Gateway URL for accessing the non-current API Revision. - PrivateURL *string `json:"privateUrl,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is the current api revision. - IsOnline *bool `json:"isOnline,omitempty"` - // IsCurrent - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsCurrent *bool `json:"isCurrent,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIRevisionContract. -func (arc APIRevisionContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// APIRevisionInfoContract object used to create an API Revision or Version based on an existing API -// Revision -type APIRevisionInfoContract struct { - // SourceAPIID - Resource identifier of API to be used to create the revision from. - SourceAPIID *string `json:"sourceApiId,omitempty"` - // APIVersionName - Version identifier for the new API Version. - APIVersionName *string `json:"apiVersionName,omitempty"` - // APIRevisionDescription - Description of new API Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionSet - Version set details - APIVersionSet *APIVersionSetContractDetails `json:"apiVersionSet,omitempty"` -} - -// APISchemaCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type APISchemaCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(APISchemaClient) (SchemaContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *APISchemaCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for APISchemaCreateOrUpdateFuture.Result. -func (future *APISchemaCreateOrUpdateFuture) result(client APISchemaClient) (sc SchemaContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.APISchemaCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sc.Response.Response, err = future.GetResult(sender); err == nil && sc.Response.Response.StatusCode != http.StatusNoContent { - sc, err = client.CreateOrUpdateResponder(sc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaCreateOrUpdateFuture", "Result", sc.Response.Response, "Failure responding to request") - } - } - return -} - -// APITagResourceContractProperties API contract properties for the Tag Resources. -type APITagResourceContractProperties struct { - // ID - API identifier in the form /apis/{apiId}. - ID *string `json:"id,omitempty"` - // Name - API name. - Name *string `json:"name,omitempty"` - // ServiceURL - Absolute URL of the backend service implementing this API. - ServiceURL *string `json:"serviceUrl,omitempty"` - // Path - Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - Path *string `json:"path,omitempty"` - // Protocols - Describes on which protocols the operations in this API can be invoked. - Protocols *[]Protocol `json:"protocols,omitempty"` - // Description - Description of the API. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthenticationSettings - Collection of authentication settings included into this API. - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - // SubscriptionKeyParameterNames - Protocols over which API is made available. - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - // APIType - Type of API. Possible values include: 'APITypeHTTP', 'APITypeSoap', 'APITypeWebsocket', 'APITypeGraphql' - APIType APIType `json:"type,omitempty"` - // APIRevision - Describes the revision of the API. If no value is provided, default revision 1 is created - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - Indicates the version identifier of the API if the API is versioned - APIVersion *string `json:"apiVersion,omitempty"` - // IsCurrent - Indicates if API revision is current api revision. - IsCurrent *bool `json:"isCurrent,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsOnline *bool `json:"isOnline,omitempty"` - // APIRevisionDescription - Description of the API Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionDescription - Description of the API Version. - APIVersionDescription *string `json:"apiVersionDescription,omitempty"` - // APIVersionSetID - A resource identifier for the related ApiVersionSet. - APIVersionSetID *string `json:"apiVersionSetId,omitempty"` - // SubscriptionRequired - Specifies whether an API or Product subscription is required for accessing the API. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // TermsOfServiceURL - A URL to the Terms of Service for the API. MUST be in the format of a URL. - TermsOfServiceURL *string `json:"termsOfServiceUrl,omitempty"` - // Contact - Contact information for the API. - Contact *APIContactInformation `json:"contact,omitempty"` - // License - License information for the API. - License *APILicenseInformation `json:"license,omitempty"` -} - -// MarshalJSON is the custom marshaler for APITagResourceContractProperties. -func (atrcp APITagResourceContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atrcp.ID != nil { - objectMap["id"] = atrcp.ID - } - if atrcp.Name != nil { - objectMap["name"] = atrcp.Name - } - if atrcp.ServiceURL != nil { - objectMap["serviceUrl"] = atrcp.ServiceURL - } - if atrcp.Path != nil { - objectMap["path"] = atrcp.Path - } - if atrcp.Protocols != nil { - objectMap["protocols"] = atrcp.Protocols - } - if atrcp.Description != nil { - objectMap["description"] = atrcp.Description - } - if atrcp.AuthenticationSettings != nil { - objectMap["authenticationSettings"] = atrcp.AuthenticationSettings - } - if atrcp.SubscriptionKeyParameterNames != nil { - objectMap["subscriptionKeyParameterNames"] = atrcp.SubscriptionKeyParameterNames - } - if atrcp.APIType != "" { - objectMap["type"] = atrcp.APIType - } - if atrcp.APIRevision != nil { - objectMap["apiRevision"] = atrcp.APIRevision - } - if atrcp.APIVersion != nil { - objectMap["apiVersion"] = atrcp.APIVersion - } - if atrcp.IsCurrent != nil { - objectMap["isCurrent"] = atrcp.IsCurrent - } - if atrcp.APIRevisionDescription != nil { - objectMap["apiRevisionDescription"] = atrcp.APIRevisionDescription - } - if atrcp.APIVersionDescription != nil { - objectMap["apiVersionDescription"] = atrcp.APIVersionDescription - } - if atrcp.APIVersionSetID != nil { - objectMap["apiVersionSetId"] = atrcp.APIVersionSetID - } - if atrcp.SubscriptionRequired != nil { - objectMap["subscriptionRequired"] = atrcp.SubscriptionRequired - } - if atrcp.TermsOfServiceURL != nil { - objectMap["termsOfServiceUrl"] = atrcp.TermsOfServiceURL - } - if atrcp.Contact != nil { - objectMap["contact"] = atrcp.Contact - } - if atrcp.License != nil { - objectMap["license"] = atrcp.License - } - return json.Marshal(objectMap) -} - -// APIUpdateContract API update contract details. -type APIUpdateContract struct { - // APIContractUpdateProperties - Properties of the API entity that can be updated. - *APIContractUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIUpdateContract. -func (auc APIUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if auc.APIContractUpdateProperties != nil { - objectMap["properties"] = auc.APIContractUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APIUpdateContract struct. -func (auc *APIUpdateContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var APIContractUpdateProperties APIContractUpdateProperties - err = json.Unmarshal(*v, &APIContractUpdateProperties) - if err != nil { - return err - } - auc.APIContractUpdateProperties = &APIContractUpdateProperties - } - } - } - - return nil -} - -// APIVersionConstraint control Plane Apis version constraint for the API Management service. -type APIVersionConstraint struct { - // MinAPIVersion - Limit control plane API calls to API Management service with version equal to or newer than this value. - MinAPIVersion *string `json:"minApiVersion,omitempty"` -} - -// APIVersionSetCollection paged API Version Set list representation. -type APIVersionSetCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]APIVersionSetContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// APIVersionSetCollectionIterator provides access to a complete listing of APIVersionSetContract values. -type APIVersionSetCollectionIterator struct { - i int - page APIVersionSetCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *APIVersionSetCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *APIVersionSetCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APIVersionSetCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter APIVersionSetCollectionIterator) Response() APIVersionSetCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter APIVersionSetCollectionIterator) Value() APIVersionSetContract { - if !iter.page.NotDone() { - return APIVersionSetContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APIVersionSetCollectionIterator type. -func NewAPIVersionSetCollectionIterator(page APIVersionSetCollectionPage) APIVersionSetCollectionIterator { - return APIVersionSetCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (avsc APIVersionSetCollection) IsEmpty() bool { - return avsc.Value == nil || len(*avsc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (avsc APIVersionSetCollection) hasNextLink() bool { - return avsc.NextLink != nil && len(*avsc.NextLink) != 0 -} - -// aPIVersionSetCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (avsc APIVersionSetCollection) aPIVersionSetCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !avsc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(avsc.NextLink))) -} - -// APIVersionSetCollectionPage contains a page of APIVersionSetContract values. -type APIVersionSetCollectionPage struct { - fn func(context.Context, APIVersionSetCollection) (APIVersionSetCollection, error) - avsc APIVersionSetCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *APIVersionSetCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.avsc) - if err != nil { - return err - } - page.avsc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *APIVersionSetCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APIVersionSetCollectionPage) NotDone() bool { - return !page.avsc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APIVersionSetCollectionPage) Response() APIVersionSetCollection { - return page.avsc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APIVersionSetCollectionPage) Values() []APIVersionSetContract { - if page.avsc.IsEmpty() { - return nil - } - return *page.avsc.Value -} - -// Creates a new instance of the APIVersionSetCollectionPage type. -func NewAPIVersionSetCollectionPage(cur APIVersionSetCollection, getNextPage func(context.Context, APIVersionSetCollection) (APIVersionSetCollection, error)) APIVersionSetCollectionPage { - return APIVersionSetCollectionPage{ - fn: getNextPage, - avsc: cur, - } -} - -// APIVersionSetContract API Version Set Contract details. -type APIVersionSetContract struct { - autorest.Response `json:"-"` - // APIVersionSetContractProperties - API VersionSet contract properties. - *APIVersionSetContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIVersionSetContract. -func (avsc APIVersionSetContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if avsc.APIVersionSetContractProperties != nil { - objectMap["properties"] = avsc.APIVersionSetContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APIVersionSetContract struct. -func (avsc *APIVersionSetContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var APIVersionSetContractProperties APIVersionSetContractProperties - err = json.Unmarshal(*v, &APIVersionSetContractProperties) - if err != nil { - return err - } - avsc.APIVersionSetContractProperties = &APIVersionSetContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - avsc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - avsc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - avsc.Type = &typeVar - } - } - } - - return nil -} - -// APIVersionSetContractDetails an API Version Set contains the common configuration for a set of API -// Versions relating -type APIVersionSetContractDetails struct { - // ID - Identifier for existing API Version Set. Omit this value to create a new Version Set. - ID *string `json:"id,omitempty"` - // Name - The display Name of the API Version Set. - Name *string `json:"name,omitempty"` - // Description - Description of API Version Set. - Description *string `json:"description,omitempty"` - // VersioningScheme - An value that determines where the API Version identifier will be located in a HTTP request. Possible values include: 'VersioningScheme1Segment', 'VersioningScheme1Query', 'VersioningScheme1Header' - VersioningScheme VersioningScheme1 `json:"versioningScheme,omitempty"` - // VersionQueryName - Name of query parameter that indicates the API Version if versioningScheme is set to `query`. - VersionQueryName *string `json:"versionQueryName,omitempty"` - // VersionHeaderName - Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. - VersionHeaderName *string `json:"versionHeaderName,omitempty"` -} - -// APIVersionSetContractProperties properties of an API Version Set. -type APIVersionSetContractProperties struct { - // DisplayName - Name of API Version Set - DisplayName *string `json:"displayName,omitempty"` - // VersioningScheme - An value that determines where the API Version identifier will be located in a HTTP request. Possible values include: 'VersioningSchemeSegment', 'VersioningSchemeQuery', 'VersioningSchemeHeader' - VersioningScheme VersioningScheme `json:"versioningScheme,omitempty"` - // Description - Description of API Version Set. - Description *string `json:"description,omitempty"` - // VersionQueryName - Name of query parameter that indicates the API Version if versioningScheme is set to `query`. - VersionQueryName *string `json:"versionQueryName,omitempty"` - // VersionHeaderName - Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. - VersionHeaderName *string `json:"versionHeaderName,omitempty"` -} - -// APIVersionSetEntityBase API Version set base parameters -type APIVersionSetEntityBase struct { - // Description - Description of API Version Set. - Description *string `json:"description,omitempty"` - // VersionQueryName - Name of query parameter that indicates the API Version if versioningScheme is set to `query`. - VersionQueryName *string `json:"versionQueryName,omitempty"` - // VersionHeaderName - Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. - VersionHeaderName *string `json:"versionHeaderName,omitempty"` -} - -// APIVersionSetUpdateParameters parameters to update or create an API Version Set Contract. -type APIVersionSetUpdateParameters struct { - // APIVersionSetUpdateParametersProperties - Parameters to update or create an API Version Set Contract. - *APIVersionSetUpdateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIVersionSetUpdateParameters. -func (avsup APIVersionSetUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if avsup.APIVersionSetUpdateParametersProperties != nil { - objectMap["properties"] = avsup.APIVersionSetUpdateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APIVersionSetUpdateParameters struct. -func (avsup *APIVersionSetUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var APIVersionSetUpdateParametersProperties APIVersionSetUpdateParametersProperties - err = json.Unmarshal(*v, &APIVersionSetUpdateParametersProperties) - if err != nil { - return err - } - avsup.APIVersionSetUpdateParametersProperties = &APIVersionSetUpdateParametersProperties - } - } - } - - return nil -} - -// APIVersionSetUpdateParametersProperties properties used to create or update an API Version Set. -type APIVersionSetUpdateParametersProperties struct { - // DisplayName - Name of API Version Set - DisplayName *string `json:"displayName,omitempty"` - // VersioningScheme - An value that determines where the API Version identifier will be located in a HTTP request. Possible values include: 'VersioningSchemeSegment', 'VersioningSchemeQuery', 'VersioningSchemeHeader' - VersioningScheme VersioningScheme `json:"versioningScheme,omitempty"` - // Description - Description of API Version Set. - Description *string `json:"description,omitempty"` - // VersionQueryName - Name of query parameter that indicates the API Version if versioningScheme is set to `query`. - VersionQueryName *string `json:"versionQueryName,omitempty"` - // VersionHeaderName - Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. - VersionHeaderName *string `json:"versionHeaderName,omitempty"` -} - -// ArmIDWrapper a wrapper for an ARM resource id -type ArmIDWrapper struct { - // ID - READ-ONLY - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ArmIDWrapper. -func (aiw ArmIDWrapper) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AssociationContract association entity details. -type AssociationContract struct { - // AssociationContractProperties - Association entity contract properties. - *AssociationContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AssociationContract. -func (ac AssociationContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ac.AssociationContractProperties != nil { - objectMap["properties"] = ac.AssociationContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AssociationContract struct. -func (ac *AssociationContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var associationContractProperties AssociationContractProperties - err = json.Unmarshal(*v, &associationContractProperties) - if err != nil { - return err - } - ac.AssociationContractProperties = &associationContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ac.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ac.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ac.Type = &typeVar - } - } - } - - return nil -} - -// AssociationContractProperties association entity contract properties. -type AssociationContractProperties struct { - // ProvisioningState - Provisioning state. Possible values include: 'ProvisioningStateCreated' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// AuthenticationSettingsContract API Authentication Settings. -type AuthenticationSettingsContract struct { - // OAuth2 - OAuth2 Authentication settings - OAuth2 *OAuth2AuthenticationSettingsContract `json:"oAuth2,omitempty"` - // Openid - OpenID Connect Authentication Settings - Openid *OpenIDAuthenticationSettingsContract `json:"openid,omitempty"` -} - -// AuthorizationServerCollection paged OAuth2 Authorization Servers list representation. -type AuthorizationServerCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]AuthorizationServerContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// AuthorizationServerCollectionIterator provides access to a complete listing of -// AuthorizationServerContract values. -type AuthorizationServerCollectionIterator struct { - i int - page AuthorizationServerCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AuthorizationServerCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AuthorizationServerCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AuthorizationServerCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AuthorizationServerCollectionIterator) Response() AuthorizationServerCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AuthorizationServerCollectionIterator) Value() AuthorizationServerContract { - if !iter.page.NotDone() { - return AuthorizationServerContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AuthorizationServerCollectionIterator type. -func NewAuthorizationServerCollectionIterator(page AuthorizationServerCollectionPage) AuthorizationServerCollectionIterator { - return AuthorizationServerCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asc AuthorizationServerCollection) IsEmpty() bool { - return asc.Value == nil || len(*asc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asc AuthorizationServerCollection) hasNextLink() bool { - return asc.NextLink != nil && len(*asc.NextLink) != 0 -} - -// authorizationServerCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asc AuthorizationServerCollection) authorizationServerCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !asc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asc.NextLink))) -} - -// AuthorizationServerCollectionPage contains a page of AuthorizationServerContract values. -type AuthorizationServerCollectionPage struct { - fn func(context.Context, AuthorizationServerCollection) (AuthorizationServerCollection, error) - asc AuthorizationServerCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AuthorizationServerCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.asc) - if err != nil { - return err - } - page.asc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AuthorizationServerCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AuthorizationServerCollectionPage) NotDone() bool { - return !page.asc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AuthorizationServerCollectionPage) Response() AuthorizationServerCollection { - return page.asc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AuthorizationServerCollectionPage) Values() []AuthorizationServerContract { - if page.asc.IsEmpty() { - return nil - } - return *page.asc.Value -} - -// Creates a new instance of the AuthorizationServerCollectionPage type. -func NewAuthorizationServerCollectionPage(cur AuthorizationServerCollection, getNextPage func(context.Context, AuthorizationServerCollection) (AuthorizationServerCollection, error)) AuthorizationServerCollectionPage { - return AuthorizationServerCollectionPage{ - fn: getNextPage, - asc: cur, - } -} - -// AuthorizationServerContract external OAuth authorization server settings. -type AuthorizationServerContract struct { - autorest.Response `json:"-"` - // AuthorizationServerContractProperties - Properties of the External OAuth authorization server Contract. - *AuthorizationServerContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AuthorizationServerContract. -func (asc AuthorizationServerContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asc.AuthorizationServerContractProperties != nil { - objectMap["properties"] = asc.AuthorizationServerContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AuthorizationServerContract struct. -func (asc *AuthorizationServerContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var authorizationServerContractProperties AuthorizationServerContractProperties - err = json.Unmarshal(*v, &authorizationServerContractProperties) - if err != nil { - return err - } - asc.AuthorizationServerContractProperties = &authorizationServerContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asc.Type = &typeVar - } - } - } - - return nil -} - -// AuthorizationServerContractBaseProperties external OAuth authorization server Update settings contract. -type AuthorizationServerContractBaseProperties struct { - // Description - Description of the authorization server. Can contain HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthorizationMethods - HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - AuthorizationMethods *[]AuthorizationMethod `json:"authorizationMethods,omitempty"` - // ClientAuthenticationMethod - Method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - ClientAuthenticationMethod *[]ClientAuthenticationMethod `json:"clientAuthenticationMethod,omitempty"` - // TokenBodyParameters - Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` - // TokenEndpoint - OAuth token endpoint. Contains absolute URI to entity being referenced. - TokenEndpoint *string `json:"tokenEndpoint,omitempty"` - // SupportState - If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - SupportState *bool `json:"supportState,omitempty"` - // DefaultScope - Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - DefaultScope *string `json:"defaultScope,omitempty"` - // BearerTokenSendingMethods - Specifies the mechanism by which access token is passed to the API. - BearerTokenSendingMethods *[]BearerTokenSendingMethod `json:"bearerTokenSendingMethods,omitempty"` - // ResourceOwnerUsername - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` - // ResourceOwnerPassword - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` -} - -// AuthorizationServerContractProperties external OAuth authorization server settings Properties. -type AuthorizationServerContractProperties struct { - // DisplayName - User-friendly authorization server name. - DisplayName *string `json:"displayName,omitempty"` - // ClientRegistrationEndpoint - Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. - ClientRegistrationEndpoint *string `json:"clientRegistrationEndpoint,omitempty"` - // AuthorizationEndpoint - OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` - // GrantTypes - Form of an authorization grant, which the client uses to request the access token. - GrantTypes *[]GrantType `json:"grantTypes,omitempty"` - // ClientID - Client or app id registered with this authorization server. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - ClientSecret *string `json:"clientSecret,omitempty"` - // Description - Description of the authorization server. Can contain HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthorizationMethods - HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - AuthorizationMethods *[]AuthorizationMethod `json:"authorizationMethods,omitempty"` - // ClientAuthenticationMethod - Method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - ClientAuthenticationMethod *[]ClientAuthenticationMethod `json:"clientAuthenticationMethod,omitempty"` - // TokenBodyParameters - Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` - // TokenEndpoint - OAuth token endpoint. Contains absolute URI to entity being referenced. - TokenEndpoint *string `json:"tokenEndpoint,omitempty"` - // SupportState - If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - SupportState *bool `json:"supportState,omitempty"` - // DefaultScope - Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - DefaultScope *string `json:"defaultScope,omitempty"` - // BearerTokenSendingMethods - Specifies the mechanism by which access token is passed to the API. - BearerTokenSendingMethods *[]BearerTokenSendingMethod `json:"bearerTokenSendingMethods,omitempty"` - // ResourceOwnerUsername - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` - // ResourceOwnerPassword - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` -} - -// AuthorizationServerSecretsContract oAuth Server Secrets Contract. -type AuthorizationServerSecretsContract struct { - autorest.Response `json:"-"` - // ClientSecret - oAuth Authorization Server Secrets. - ClientSecret *string `json:"clientSecret,omitempty"` - // ResourceOwnerUsername - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` - // ResourceOwnerPassword - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` -} - -// AuthorizationServerUpdateContract external OAuth authorization server settings. -type AuthorizationServerUpdateContract struct { - // AuthorizationServerUpdateContractProperties - Properties of the External OAuth authorization server update Contract. - *AuthorizationServerUpdateContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AuthorizationServerUpdateContract. -func (asuc AuthorizationServerUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asuc.AuthorizationServerUpdateContractProperties != nil { - objectMap["properties"] = asuc.AuthorizationServerUpdateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AuthorizationServerUpdateContract struct. -func (asuc *AuthorizationServerUpdateContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var authorizationServerUpdateContractProperties AuthorizationServerUpdateContractProperties - err = json.Unmarshal(*v, &authorizationServerUpdateContractProperties) - if err != nil { - return err - } - asuc.AuthorizationServerUpdateContractProperties = &authorizationServerUpdateContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asuc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asuc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asuc.Type = &typeVar - } - } - } - - return nil -} - -// AuthorizationServerUpdateContractProperties external OAuth authorization server Update settings -// contract. -type AuthorizationServerUpdateContractProperties struct { - // DisplayName - User-friendly authorization server name. - DisplayName *string `json:"displayName,omitempty"` - // ClientRegistrationEndpoint - Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. - ClientRegistrationEndpoint *string `json:"clientRegistrationEndpoint,omitempty"` - // AuthorizationEndpoint - OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` - // GrantTypes - Form of an authorization grant, which the client uses to request the access token. - GrantTypes *[]GrantType `json:"grantTypes,omitempty"` - // ClientID - Client or app id registered with this authorization server. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - ClientSecret *string `json:"clientSecret,omitempty"` - // Description - Description of the authorization server. Can contain HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthorizationMethods - HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - AuthorizationMethods *[]AuthorizationMethod `json:"authorizationMethods,omitempty"` - // ClientAuthenticationMethod - Method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - ClientAuthenticationMethod *[]ClientAuthenticationMethod `json:"clientAuthenticationMethod,omitempty"` - // TokenBodyParameters - Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` - // TokenEndpoint - OAuth token endpoint. Contains absolute URI to entity being referenced. - TokenEndpoint *string `json:"tokenEndpoint,omitempty"` - // SupportState - If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - SupportState *bool `json:"supportState,omitempty"` - // DefaultScope - Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - DefaultScope *string `json:"defaultScope,omitempty"` - // BearerTokenSendingMethods - Specifies the mechanism by which access token is passed to the API. - BearerTokenSendingMethods *[]BearerTokenSendingMethod `json:"bearerTokenSendingMethods,omitempty"` - // ResourceOwnerUsername - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` - // ResourceOwnerPassword - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BackendAuthorizationHeaderCredentials authorization header information. -type BackendAuthorizationHeaderCredentials struct { - // Scheme - Authentication Scheme name. - Scheme *string `json:"scheme,omitempty"` - // Parameter - Authentication Parameter value. - Parameter *string `json:"parameter,omitempty"` -} - -// BackendBaseParameters backend entity base Parameter set. -type BackendBaseParameters struct { - // Title - Backend Title. - Title *string `json:"title,omitempty"` - // Description - Backend Description. - Description *string `json:"description,omitempty"` - // ResourceID - Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. - ResourceID *string `json:"resourceId,omitempty"` - // Properties - Backend Properties contract - Properties *BackendProperties `json:"properties,omitempty"` - // Credentials - Backend Credentials Contract Properties - Credentials *BackendCredentialsContract `json:"credentials,omitempty"` - // Proxy - Backend Proxy Contract Properties - Proxy *BackendProxyContract `json:"proxy,omitempty"` - // TLS - Backend TLS Properties - TLS *BackendTLSProperties `json:"tls,omitempty"` -} - -// BackendCollection paged Backend list representation. -type BackendCollection struct { - autorest.Response `json:"-"` - // Value - Backend values. - Value *[]BackendContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// BackendCollectionIterator provides access to a complete listing of BackendContract values. -type BackendCollectionIterator struct { - i int - page BackendCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BackendCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BackendCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BackendCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BackendCollectionIterator) Response() BackendCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BackendCollectionIterator) Value() BackendContract { - if !iter.page.NotDone() { - return BackendContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BackendCollectionIterator type. -func NewBackendCollectionIterator(page BackendCollectionPage) BackendCollectionIterator { - return BackendCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bc BackendCollection) IsEmpty() bool { - return bc.Value == nil || len(*bc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bc BackendCollection) hasNextLink() bool { - return bc.NextLink != nil && len(*bc.NextLink) != 0 -} - -// backendCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bc BackendCollection) backendCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !bc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bc.NextLink))) -} - -// BackendCollectionPage contains a page of BackendContract values. -type BackendCollectionPage struct { - fn func(context.Context, BackendCollection) (BackendCollection, error) - bc BackendCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BackendCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.bc) - if err != nil { - return err - } - page.bc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BackendCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BackendCollectionPage) NotDone() bool { - return !page.bc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BackendCollectionPage) Response() BackendCollection { - return page.bc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BackendCollectionPage) Values() []BackendContract { - if page.bc.IsEmpty() { - return nil - } - return *page.bc.Value -} - -// Creates a new instance of the BackendCollectionPage type. -func NewBackendCollectionPage(cur BackendCollection, getNextPage func(context.Context, BackendCollection) (BackendCollection, error)) BackendCollectionPage { - return BackendCollectionPage{ - fn: getNextPage, - bc: cur, - } -} - -// BackendContract backend details. -type BackendContract struct { - autorest.Response `json:"-"` - // BackendContractProperties - Backend entity contract properties. - *BackendContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendContract. -func (bc BackendContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bc.BackendContractProperties != nil { - objectMap["properties"] = bc.BackendContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackendContract struct. -func (bc *BackendContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var backendContractProperties BackendContractProperties - err = json.Unmarshal(*v, &backendContractProperties) - if err != nil { - return err - } - bc.BackendContractProperties = &backendContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bc.Type = &typeVar - } - } - } - - return nil -} - -// BackendContractProperties parameters supplied to the Create Backend operation. -type BackendContractProperties struct { - // URL - Runtime Url of the Backend. - URL *string `json:"url,omitempty"` - // Protocol - Backend communication protocol. Possible values include: 'BackendProtocolHTTP', 'BackendProtocolSoap' - Protocol BackendProtocol `json:"protocol,omitempty"` - // Title - Backend Title. - Title *string `json:"title,omitempty"` - // Description - Backend Description. - Description *string `json:"description,omitempty"` - // ResourceID - Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. - ResourceID *string `json:"resourceId,omitempty"` - // Properties - Backend Properties contract - Properties *BackendProperties `json:"properties,omitempty"` - // Credentials - Backend Credentials Contract Properties - Credentials *BackendCredentialsContract `json:"credentials,omitempty"` - // Proxy - Backend Proxy Contract Properties - Proxy *BackendProxyContract `json:"proxy,omitempty"` - // TLS - Backend TLS Properties - TLS *BackendTLSProperties `json:"tls,omitempty"` -} - -// BackendCredentialsContract details of the Credentials used to connect to Backend. -type BackendCredentialsContract struct { - // CertificateIds - List of Client Certificate Ids. - CertificateIds *[]string `json:"certificateIds,omitempty"` - // Certificate - List of Client Certificate Thumbprints. Will be ignored if certificatesIds are provided. - Certificate *[]string `json:"certificate,omitempty"` - // Query - Query Parameter description. - Query map[string][]string `json:"query"` - // Header - Header Parameter description. - Header map[string][]string `json:"header"` - // Authorization - Authorization header authentication - Authorization *BackendAuthorizationHeaderCredentials `json:"authorization,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendCredentialsContract. -func (bcc BackendCredentialsContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bcc.CertificateIds != nil { - objectMap["certificateIds"] = bcc.CertificateIds - } - if bcc.Certificate != nil { - objectMap["certificate"] = bcc.Certificate - } - if bcc.Query != nil { - objectMap["query"] = bcc.Query - } - if bcc.Header != nil { - objectMap["header"] = bcc.Header - } - if bcc.Authorization != nil { - objectMap["authorization"] = bcc.Authorization - } - return json.Marshal(objectMap) -} - -// BackendProperties properties specific to the Backend Type. -type BackendProperties struct { - // ServiceFabricCluster - Backend Service Fabric Cluster Properties - ServiceFabricCluster *BackendServiceFabricClusterProperties `json:"serviceFabricCluster,omitempty"` -} - -// BackendProxyContract details of the Backend WebProxy Server to use in the Request to Backend. -type BackendProxyContract struct { - // URL - WebProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all fragments and query strings. - URL *string `json:"url,omitempty"` - // Username - Username to connect to the WebProxy server - Username *string `json:"username,omitempty"` - // Password - Password to connect to the WebProxy Server - Password *string `json:"password,omitempty"` -} - -// BackendReconnectContract reconnect request parameters. -type BackendReconnectContract struct { - // BackendReconnectProperties - Reconnect request properties. - *BackendReconnectProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendReconnectContract. -func (brc BackendReconnectContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if brc.BackendReconnectProperties != nil { - objectMap["properties"] = brc.BackendReconnectProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackendReconnectContract struct. -func (brc *BackendReconnectContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var backendReconnectProperties BackendReconnectProperties - err = json.Unmarshal(*v, &backendReconnectProperties) - if err != nil { - return err - } - brc.BackendReconnectProperties = &backendReconnectProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - brc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - brc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - brc.Type = &typeVar - } - } - } - - return nil -} - -// BackendReconnectProperties properties to control reconnect requests. -type BackendReconnectProperties struct { - // After - Duration in ISO8601 format after which reconnect will be initiated. Minimum duration of the Reconnect is PT2M. - After *string `json:"after,omitempty"` -} - -// BackendServiceFabricClusterProperties properties of the Service Fabric Type Backend. -type BackendServiceFabricClusterProperties struct { - // ClientCertificateID - The client certificate id for the management endpoint. - ClientCertificateID *string `json:"clientCertificateId,omitempty"` - // ClientCertificatethumbprint - The client certificate thumbprint for the management endpoint. Will be ignored if certificatesIds are provided - ClientCertificatethumbprint *string `json:"clientCertificatethumbprint,omitempty"` - // MaxPartitionResolutionRetries - Maximum number of retries while attempting resolve the partition. - MaxPartitionResolutionRetries *int32 `json:"maxPartitionResolutionRetries,omitempty"` - // ManagementEndpoints - The cluster management endpoint. - ManagementEndpoints *[]string `json:"managementEndpoints,omitempty"` - // ServerCertificateThumbprints - Thumbprints of certificates cluster management service uses for tls communication - ServerCertificateThumbprints *[]string `json:"serverCertificateThumbprints,omitempty"` - // ServerX509Names - Server X509 Certificate Names Collection - ServerX509Names *[]X509CertificateName `json:"serverX509Names,omitempty"` -} - -// BackendTLSProperties properties controlling TLS Certificate Validation. -type BackendTLSProperties struct { - // ValidateCertificateChain - Flag indicating whether SSL certificate chain validation should be done when using self-signed certificates for this backend host. - ValidateCertificateChain *bool `json:"validateCertificateChain,omitempty"` - // ValidateCertificateName - Flag indicating whether SSL certificate name validation should be done when using self-signed certificates for this backend host. - ValidateCertificateName *bool `json:"validateCertificateName,omitempty"` -} - -// BackendUpdateParameterProperties parameters supplied to the Update Backend operation. -type BackendUpdateParameterProperties struct { - // URL - Runtime Url of the Backend. - URL *string `json:"url,omitempty"` - // Protocol - Backend communication protocol. Possible values include: 'BackendProtocolHTTP', 'BackendProtocolSoap' - Protocol BackendProtocol `json:"protocol,omitempty"` - // Title - Backend Title. - Title *string `json:"title,omitempty"` - // Description - Backend Description. - Description *string `json:"description,omitempty"` - // ResourceID - Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. - ResourceID *string `json:"resourceId,omitempty"` - // Properties - Backend Properties contract - Properties *BackendProperties `json:"properties,omitempty"` - // Credentials - Backend Credentials Contract Properties - Credentials *BackendCredentialsContract `json:"credentials,omitempty"` - // Proxy - Backend Proxy Contract Properties - Proxy *BackendProxyContract `json:"proxy,omitempty"` - // TLS - Backend TLS Properties - TLS *BackendTLSProperties `json:"tls,omitempty"` -} - -// BackendUpdateParameters backend update parameters. -type BackendUpdateParameters struct { - // BackendUpdateParameterProperties - Backend entity update contract properties. - *BackendUpdateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendUpdateParameters. -func (bup BackendUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bup.BackendUpdateParameterProperties != nil { - objectMap["properties"] = bup.BackendUpdateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackendUpdateParameters struct. -func (bup *BackendUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var backendUpdateParameterProperties BackendUpdateParameterProperties - err = json.Unmarshal(*v, &backendUpdateParameterProperties) - if err != nil { - return err - } - bup.BackendUpdateParameterProperties = &backendUpdateParameterProperties - } - } - } - - return nil -} - -// BodyDiagnosticSettings body logging settings. -type BodyDiagnosticSettings struct { - // Bytes - Number of request body bytes to log. - Bytes *int32 `json:"bytes,omitempty"` -} - -// CacheCollection paged Caches list representation. -type CacheCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]CacheContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// CacheCollectionIterator provides access to a complete listing of CacheContract values. -type CacheCollectionIterator struct { - i int - page CacheCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *CacheCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *CacheCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CacheCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter CacheCollectionIterator) Response() CacheCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter CacheCollectionIterator) Value() CacheContract { - if !iter.page.NotDone() { - return CacheContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CacheCollectionIterator type. -func NewCacheCollectionIterator(page CacheCollectionPage) CacheCollectionIterator { - return CacheCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cc CacheCollection) IsEmpty() bool { - return cc.Value == nil || len(*cc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cc CacheCollection) hasNextLink() bool { - return cc.NextLink != nil && len(*cc.NextLink) != 0 -} - -// cacheCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cc CacheCollection) cacheCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !cc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cc.NextLink))) -} - -// CacheCollectionPage contains a page of CacheContract values. -type CacheCollectionPage struct { - fn func(context.Context, CacheCollection) (CacheCollection, error) - cc CacheCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *CacheCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cc) - if err != nil { - return err - } - page.cc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *CacheCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CacheCollectionPage) NotDone() bool { - return !page.cc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CacheCollectionPage) Response() CacheCollection { - return page.cc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CacheCollectionPage) Values() []CacheContract { - if page.cc.IsEmpty() { - return nil - } - return *page.cc.Value -} - -// Creates a new instance of the CacheCollectionPage type. -func NewCacheCollectionPage(cur CacheCollection, getNextPage func(context.Context, CacheCollection) (CacheCollection, error)) CacheCollectionPage { - return CacheCollectionPage{ - fn: getNextPage, - cc: cur, - } -} - -// CacheContract cache details. -type CacheContract struct { - autorest.Response `json:"-"` - // CacheContractProperties - Cache properties details. - *CacheContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for CacheContract. -func (cc CacheContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cc.CacheContractProperties != nil { - objectMap["properties"] = cc.CacheContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CacheContract struct. -func (cc *CacheContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var cacheContractProperties CacheContractProperties - err = json.Unmarshal(*v, &cacheContractProperties) - if err != nil { - return err - } - cc.CacheContractProperties = &cacheContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cc.Type = &typeVar - } - } - } - - return nil -} - -// CacheContractProperties properties of the Cache contract. -type CacheContractProperties struct { - // Description - Cache description - Description *string `json:"description,omitempty"` - // ConnectionString - Runtime connection string to cache - ConnectionString *string `json:"connectionString,omitempty"` - // UseFromLocation - Location identifier to use cache from (should be either 'default' or valid Azure region identifier) - UseFromLocation *string `json:"useFromLocation,omitempty"` - // ResourceID - Original uri of entity in external system cache points to - ResourceID *string `json:"resourceId,omitempty"` -} - -// CacheUpdateParameters cache update details. -type CacheUpdateParameters struct { - // CacheUpdateProperties - Cache update properties details. - *CacheUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CacheUpdateParameters. -func (cup CacheUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.CacheUpdateProperties != nil { - objectMap["properties"] = cup.CacheUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CacheUpdateParameters struct. -func (cup *CacheUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var cacheUpdateProperties CacheUpdateProperties - err = json.Unmarshal(*v, &cacheUpdateProperties) - if err != nil { - return err - } - cup.CacheUpdateProperties = &cacheUpdateProperties - } - } - } - - return nil -} - -// CacheUpdateProperties parameters supplied to the Update Cache operation. -type CacheUpdateProperties struct { - // Description - Cache description - Description *string `json:"description,omitempty"` - // ConnectionString - Runtime connection string to cache - ConnectionString *string `json:"connectionString,omitempty"` - // UseFromLocation - Location identifier to use cache from (should be either 'default' or valid Azure region identifier) - UseFromLocation *string `json:"useFromLocation,omitempty"` - // ResourceID - Original uri of entity in external system cache points to - ResourceID *string `json:"resourceId,omitempty"` -} - -// CertificateCollection paged Certificates list representation. -type CertificateCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]CertificateContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// CertificateCollectionIterator provides access to a complete listing of CertificateContract values. -type CertificateCollectionIterator struct { - i int - page CertificateCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *CertificateCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *CertificateCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CertificateCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter CertificateCollectionIterator) Response() CertificateCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter CertificateCollectionIterator) Value() CertificateContract { - if !iter.page.NotDone() { - return CertificateContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CertificateCollectionIterator type. -func NewCertificateCollectionIterator(page CertificateCollectionPage) CertificateCollectionIterator { - return CertificateCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cc CertificateCollection) IsEmpty() bool { - return cc.Value == nil || len(*cc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cc CertificateCollection) hasNextLink() bool { - return cc.NextLink != nil && len(*cc.NextLink) != 0 -} - -// certificateCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cc CertificateCollection) certificateCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !cc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cc.NextLink))) -} - -// CertificateCollectionPage contains a page of CertificateContract values. -type CertificateCollectionPage struct { - fn func(context.Context, CertificateCollection) (CertificateCollection, error) - cc CertificateCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *CertificateCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cc) - if err != nil { - return err - } - page.cc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *CertificateCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CertificateCollectionPage) NotDone() bool { - return !page.cc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CertificateCollectionPage) Response() CertificateCollection { - return page.cc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CertificateCollectionPage) Values() []CertificateContract { - if page.cc.IsEmpty() { - return nil - } - return *page.cc.Value -} - -// Creates a new instance of the CertificateCollectionPage type. -func NewCertificateCollectionPage(cur CertificateCollection, getNextPage func(context.Context, CertificateCollection) (CertificateCollection, error)) CertificateCollectionPage { - return CertificateCollectionPage{ - fn: getNextPage, - cc: cur, - } -} - -// CertificateConfiguration certificate configuration which consist of non-trusted intermediates and root -// certificates. -type CertificateConfiguration struct { - // EncodedCertificate - Base64 Encoded certificate. - EncodedCertificate *string `json:"encodedCertificate,omitempty"` - // CertificatePassword - Certificate Password. - CertificatePassword *string `json:"certificatePassword,omitempty"` - // StoreName - The System.Security.Cryptography.x509certificates.StoreName certificate store location. Only Root and CertificateAuthority are valid locations. Possible values include: 'StoreNameCertificateAuthority', 'StoreNameRoot' - StoreName StoreName `json:"storeName,omitempty"` - // Certificate - Certificate information. - Certificate *CertificateInformation `json:"certificate,omitempty"` -} - -// CertificateContract certificate details. -type CertificateContract struct { - autorest.Response `json:"-"` - // CertificateContractProperties - Certificate properties details. - *CertificateContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateContract. -func (cc CertificateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cc.CertificateContractProperties != nil { - objectMap["properties"] = cc.CertificateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CertificateContract struct. -func (cc *CertificateContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var certificateContractProperties CertificateContractProperties - err = json.Unmarshal(*v, &certificateContractProperties) - if err != nil { - return err - } - cc.CertificateContractProperties = &certificateContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cc.Type = &typeVar - } - } - } - - return nil -} - -// CertificateContractProperties properties of the Certificate contract. -type CertificateContractProperties struct { - // Subject - Subject attribute of the certificate. - Subject *string `json:"subject,omitempty"` - // Thumbprint - Thumbprint of the certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // ExpirationDate - Expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - // KeyVault - KeyVault location details of the certificate. - KeyVault *KeyVaultContractProperties `json:"keyVault,omitempty"` -} - -// CertificateCreateOrUpdateParameters certificate create or update details. -type CertificateCreateOrUpdateParameters struct { - // CertificateCreateOrUpdateProperties - Certificate create or update properties details. - *CertificateCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateCreateOrUpdateParameters. -func (ccoup CertificateCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccoup.CertificateCreateOrUpdateProperties != nil { - objectMap["properties"] = ccoup.CertificateCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CertificateCreateOrUpdateParameters struct. -func (ccoup *CertificateCreateOrUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var certificateCreateOrUpdateProperties CertificateCreateOrUpdateProperties - err = json.Unmarshal(*v, &certificateCreateOrUpdateProperties) - if err != nil { - return err - } - ccoup.CertificateCreateOrUpdateProperties = &certificateCreateOrUpdateProperties - } - } - } - - return nil -} - -// CertificateCreateOrUpdateProperties parameters supplied to the CreateOrUpdate certificate operation. -type CertificateCreateOrUpdateProperties struct { - // Data - Base 64 encoded certificate using the application/x-pkcs12 representation. - Data *string `json:"data,omitempty"` - // Password - Password for the Certificate - Password *string `json:"password,omitempty"` - // KeyVault - KeyVault location details of the certificate. - KeyVault *KeyVaultContractCreateProperties `json:"keyVault,omitempty"` -} - -// CertificateInformation SSL certificate information. -type CertificateInformation struct { - // Expiry - Expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Expiry *date.Time `json:"expiry,omitempty"` - // Thumbprint - Thumbprint of the certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // Subject - Subject of the certificate. - Subject *string `json:"subject,omitempty"` -} - -// ClientSecretContract client or app secret used in IdentityProviders, Aad, OpenID or OAuth. -type ClientSecretContract struct { - autorest.Response `json:"-"` - // ClientSecret - Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. - ClientSecret *string `json:"clientSecret,omitempty"` -} - -// ConnectivityCheckRequest a request to perform the connectivity check operation on a API Management -// service. -type ConnectivityCheckRequest struct { - // Source - Definitions about the connectivity check origin. - Source *ConnectivityCheckRequestSource `json:"source,omitempty"` - // Destination - The connectivity check operation destination. - Destination *ConnectivityCheckRequestDestination `json:"destination,omitempty"` - // PreferredIPVersion - The IP version to be used. Only IPv4 is supported for now. Possible values include: 'PreferredIPVersionIPv4' - PreferredIPVersion PreferredIPVersion `json:"preferredIPVersion,omitempty"` - // Protocol - The request's protocol. Specific protocol configuration can be available based on this selection. The specified destination address must be coherent with this value. Possible values include: 'ConnectivityCheckProtocolTCP', 'ConnectivityCheckProtocolHTTP', 'ConnectivityCheckProtocolHTTPS' - Protocol ConnectivityCheckProtocol `json:"protocol,omitempty"` - // ProtocolConfiguration - Protocol-specific configuration. - ProtocolConfiguration *ConnectivityCheckRequestProtocolConfiguration `json:"protocolConfiguration,omitempty"` -} - -// ConnectivityCheckRequestDestination the connectivity check operation destination. -type ConnectivityCheckRequestDestination struct { - // Address - Destination address. Can either be an IP address or a FQDN. - Address *string `json:"address,omitempty"` - // Port - Destination port. - Port *int64 `json:"port,omitempty"` -} - -// ConnectivityCheckRequestProtocolConfiguration protocol-specific configuration. -type ConnectivityCheckRequestProtocolConfiguration struct { - // HTTPConfiguration - Configuration for HTTP or HTTPS requests. - HTTPConfiguration *ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration `json:"HTTPConfiguration,omitempty"` -} - -// ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration configuration for HTTP or HTTPS requests. -type ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration struct { - // Method - The HTTP method to be used. Possible values include: 'MethodGET', 'MethodPOST' - Method Method `json:"method,omitempty"` - // ValidStatusCodes - List of HTTP status codes considered valid for the request response. - ValidStatusCodes *[]int64 `json:"validStatusCodes,omitempty"` - // Headers - List of headers to be included in the request. - Headers *[]HTTPHeader `json:"headers,omitempty"` -} - -// ConnectivityCheckRequestSource definitions about the connectivity check origin. -type ConnectivityCheckRequestSource struct { - // Region - The API Management service region from where to start the connectivity check operation. - Region *string `json:"region,omitempty"` - // Instance - The particular VMSS instance from which to fire the request. - Instance *int64 `json:"instance,omitempty"` -} - -// ConnectivityCheckResponse information on the connectivity status. -type ConnectivityCheckResponse struct { - autorest.Response `json:"-"` - // Hops - READ-ONLY; List of hops between the source and the destination. - Hops *[]ConnectivityHop `json:"hops,omitempty"` - // ConnectionStatus - READ-ONLY; The connection status. Possible values include: 'ConnectionStatusUnknown', 'ConnectionStatusConnected', 'ConnectionStatusDisconnected', 'ConnectionStatusDegraded' - ConnectionStatus ConnectionStatus `json:"connectionStatus,omitempty"` - // AvgLatencyInMs - READ-ONLY; Average latency in milliseconds. - AvgLatencyInMs *int64 `json:"avgLatencyInMs,omitempty"` - // MinLatencyInMs - READ-ONLY; Minimum latency in milliseconds. - MinLatencyInMs *int64 `json:"minLatencyInMs,omitempty"` - // MaxLatencyInMs - READ-ONLY; Maximum latency in milliseconds. - MaxLatencyInMs *int64 `json:"maxLatencyInMs,omitempty"` - // ProbesSent - READ-ONLY; Total number of probes sent. - ProbesSent *int64 `json:"probesSent,omitempty"` - // ProbesFailed - READ-ONLY; Number of failed probes. - ProbesFailed *int64 `json:"probesFailed,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectivityCheckResponse. -func (ccr ConnectivityCheckResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConnectivityHop information about a hop between the source and the destination. -type ConnectivityHop struct { - // Type - READ-ONLY; The type of the hop. - Type *string `json:"type,omitempty"` - // ID - READ-ONLY; The ID of the hop. - ID *string `json:"id,omitempty"` - // Address - READ-ONLY; The IP address of the hop. - Address *string `json:"address,omitempty"` - // ResourceID - READ-ONLY; The ID of the resource corresponding to this hop. - ResourceID *string `json:"resourceId,omitempty"` - // NextHopIds - READ-ONLY; List of next hop identifiers. - NextHopIds *[]string `json:"nextHopIds,omitempty"` - // Issues - READ-ONLY; List of issues. - Issues *[]ConnectivityIssue `json:"issues,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectivityHop. -func (ch ConnectivityHop) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConnectivityIssue information about an issue encountered in the process of checking for connectivity. -type ConnectivityIssue struct { - // Origin - READ-ONLY; The origin of the issue. Possible values include: 'OriginLocal', 'OriginInbound', 'OriginOutbound' - Origin Origin `json:"origin,omitempty"` - // Severity - READ-ONLY; The severity of the issue. Possible values include: 'SeverityError', 'SeverityWarning' - Severity Severity `json:"severity,omitempty"` - // Type - READ-ONLY; The type of issue. Possible values include: 'IssueTypeUnknown', 'IssueTypeAgentStopped', 'IssueTypeGuestFirewall', 'IssueTypeDNSResolution', 'IssueTypeSocketBind', 'IssueTypeNetworkSecurityRule', 'IssueTypeUserDefinedRoute', 'IssueTypePortThrottled', 'IssueTypePlatform' - Type IssueType `json:"type,omitempty"` - // Context - READ-ONLY; Provides additional context on the issue. - Context *[]map[string]*string `json:"context,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectivityIssue. -func (ci ConnectivityIssue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConnectivityStatusContract details about connectivity to a resource. -type ConnectivityStatusContract struct { - // Name - The hostname of the resource which the service depends on. This can be the database, storage or any other azure resource on which the service depends upon. - Name *string `json:"name,omitempty"` - // Status - Resource Connectivity Status Type identifier. Possible values include: 'ConnectivityStatusTypeInitializing', 'ConnectivityStatusTypeSuccess', 'ConnectivityStatusTypeFailure' - Status ConnectivityStatusType `json:"status,omitempty"` - // Error - Error details of the connectivity to the resource. - Error *string `json:"error,omitempty"` - // LastUpdated - The date when the resource connectivity status was last updated. This status should be updated every 15 minutes. If this status has not been updated, then it means that the service has lost network connectivity to the resource, from inside the Virtual Network.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - LastUpdated *date.Time `json:"lastUpdated,omitempty"` - // LastStatusChange - The date when the resource connectivity status last Changed from success to failure or vice-versa. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - LastStatusChange *date.Time `json:"lastStatusChange,omitempty"` - // ResourceType - Resource Type. - ResourceType *string `json:"resourceType,omitempty"` - // IsOptional - Whether this is optional. - IsOptional *bool `json:"isOptional,omitempty"` -} - -// ContentItemCollection paged list of content items. -type ContentItemCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Collection of content items. - Value *[]ContentItemContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link, if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContentItemCollection. -func (cic ContentItemCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ContentItemCollectionIterator provides access to a complete listing of ContentItemContract values. -type ContentItemCollectionIterator struct { - i int - page ContentItemCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ContentItemCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContentItemCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ContentItemCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ContentItemCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ContentItemCollectionIterator) Response() ContentItemCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ContentItemCollectionIterator) Value() ContentItemContract { - if !iter.page.NotDone() { - return ContentItemContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ContentItemCollectionIterator type. -func NewContentItemCollectionIterator(page ContentItemCollectionPage) ContentItemCollectionIterator { - return ContentItemCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cic ContentItemCollection) IsEmpty() bool { - return cic.Value == nil || len(*cic.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cic ContentItemCollection) hasNextLink() bool { - return cic.NextLink != nil && len(*cic.NextLink) != 0 -} - -// contentItemCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cic ContentItemCollection) contentItemCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !cic.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cic.NextLink))) -} - -// ContentItemCollectionPage contains a page of ContentItemContract values. -type ContentItemCollectionPage struct { - fn func(context.Context, ContentItemCollection) (ContentItemCollection, error) - cic ContentItemCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ContentItemCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContentItemCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cic) - if err != nil { - return err - } - page.cic = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ContentItemCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ContentItemCollectionPage) NotDone() bool { - return !page.cic.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ContentItemCollectionPage) Response() ContentItemCollection { - return page.cic -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ContentItemCollectionPage) Values() []ContentItemContract { - if page.cic.IsEmpty() { - return nil - } - return *page.cic.Value -} - -// Creates a new instance of the ContentItemCollectionPage type. -func NewContentItemCollectionPage(cur ContentItemCollection, getNextPage func(context.Context, ContentItemCollection) (ContentItemCollection, error)) ContentItemCollectionPage { - return ContentItemCollectionPage{ - fn: getNextPage, - cic: cur, - } -} - -// ContentItemContract content type contract details. -type ContentItemContract struct { - autorest.Response `json:"-"` - // Properties - Properties of the content item. - Properties map[string]interface{} `json:"properties"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContentItemContract. -func (cic ContentItemContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cic.Properties != nil { - objectMap["properties"] = cic.Properties - } - return json.Marshal(objectMap) -} - -// ContentTypeCollection paged list of content types. -type ContentTypeCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Collection of content types. - Value *[]ContentTypeContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link, if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContentTypeCollection. -func (ctc ContentTypeCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ContentTypeCollectionIterator provides access to a complete listing of ContentTypeContract values. -type ContentTypeCollectionIterator struct { - i int - page ContentTypeCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ContentTypeCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContentTypeCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ContentTypeCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ContentTypeCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ContentTypeCollectionIterator) Response() ContentTypeCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ContentTypeCollectionIterator) Value() ContentTypeContract { - if !iter.page.NotDone() { - return ContentTypeContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ContentTypeCollectionIterator type. -func NewContentTypeCollectionIterator(page ContentTypeCollectionPage) ContentTypeCollectionIterator { - return ContentTypeCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ctc ContentTypeCollection) IsEmpty() bool { - return ctc.Value == nil || len(*ctc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ctc ContentTypeCollection) hasNextLink() bool { - return ctc.NextLink != nil && len(*ctc.NextLink) != 0 -} - -// contentTypeCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ctc ContentTypeCollection) contentTypeCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !ctc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ctc.NextLink))) -} - -// ContentTypeCollectionPage contains a page of ContentTypeContract values. -type ContentTypeCollectionPage struct { - fn func(context.Context, ContentTypeCollection) (ContentTypeCollection, error) - ctc ContentTypeCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ContentTypeCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContentTypeCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ctc) - if err != nil { - return err - } - page.ctc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ContentTypeCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ContentTypeCollectionPage) NotDone() bool { - return !page.ctc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ContentTypeCollectionPage) Response() ContentTypeCollection { - return page.ctc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ContentTypeCollectionPage) Values() []ContentTypeContract { - if page.ctc.IsEmpty() { - return nil - } - return *page.ctc.Value -} - -// Creates a new instance of the ContentTypeCollectionPage type. -func NewContentTypeCollectionPage(cur ContentTypeCollection, getNextPage func(context.Context, ContentTypeCollection) (ContentTypeCollection, error)) ContentTypeCollectionPage { - return ContentTypeCollectionPage{ - fn: getNextPage, - ctc: cur, - } -} - -// ContentTypeContract content type contract details. -type ContentTypeContract struct { - autorest.Response `json:"-"` - // ContentTypeContractProperties - Properties of the content type. - *ContentTypeContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContentTypeContract. -func (ctc ContentTypeContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctc.ContentTypeContractProperties != nil { - objectMap["properties"] = ctc.ContentTypeContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ContentTypeContract struct. -func (ctc *ContentTypeContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var contentTypeContractProperties ContentTypeContractProperties - err = json.Unmarshal(*v, &contentTypeContractProperties) - if err != nil { - return err - } - ctc.ContentTypeContractProperties = &contentTypeContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ctc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ctc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ctc.Type = &typeVar - } - } - } - - return nil -} - -// ContentTypeContractProperties ... -type ContentTypeContractProperties struct { - // ID - Content type identifier - ID *string `json:"id,omitempty"` - // Name - Content type name. Must be 1 to 250 characters long. - Name *string `json:"name,omitempty"` - // Description - Content type description. - Description *string `json:"description,omitempty"` - // Schema - Content type schema. - Schema interface{} `json:"schema,omitempty"` - // Version - Content type version. - Version *string `json:"version,omitempty"` -} - -// DataMasking ... -type DataMasking struct { - // QueryParams - Masking settings for Url query parameters - QueryParams *[]DataMaskingEntity `json:"queryParams,omitempty"` - // Headers - Masking settings for headers - Headers *[]DataMaskingEntity `json:"headers,omitempty"` -} - -// DataMaskingEntity ... -type DataMaskingEntity struct { - // Value - The name of an entity to mask (e.g. a name of a header or a query parameter). - Value *string `json:"value,omitempty"` - // Mode - Data masking mode. Possible values include: 'DataMaskingModeMask', 'DataMaskingModeHide' - Mode DataMaskingMode `json:"mode,omitempty"` -} - -// DeletedServiceContract deleted API Management Service information. -type DeletedServiceContract struct { - autorest.Response `json:"-"` - // DeletedServiceContractProperties - Deleted API Management Service details. - *DeletedServiceContractProperties `json:"properties,omitempty"` - // Location - READ-ONLY; API Management Service Master Location. - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeletedServiceContract. -func (dsc DeletedServiceContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dsc.DeletedServiceContractProperties != nil { - objectMap["properties"] = dsc.DeletedServiceContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DeletedServiceContract struct. -func (dsc *DeletedServiceContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var deletedServiceContractProperties DeletedServiceContractProperties - err = json.Unmarshal(*v, &deletedServiceContractProperties) - if err != nil { - return err - } - dsc.DeletedServiceContractProperties = &deletedServiceContractProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dsc.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dsc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dsc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dsc.Type = &typeVar - } - } - } - - return nil -} - -// DeletedServiceContractProperties ... -type DeletedServiceContractProperties struct { - // ServiceID - Fully-qualified API Management Service Resource ID - ServiceID *string `json:"serviceId,omitempty"` - // ScheduledPurgeDate - UTC Date and Time when the service will be automatically purged. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - ScheduledPurgeDate *date.Time `json:"scheduledPurgeDate,omitempty"` - // DeletionDate - UTC Timestamp when the service was soft-deleted. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - DeletionDate *date.Time `json:"deletionDate,omitempty"` -} - -// DeletedServicesCollection paged deleted API Management Services List Representation. -type DeletedServicesCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]DeletedServiceContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeletedServicesCollection. -func (dsc DeletedServicesCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DeletedServicesCollectionIterator provides access to a complete listing of DeletedServiceContract -// values. -type DeletedServicesCollectionIterator struct { - i int - page DeletedServicesCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DeletedServicesCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeletedServicesCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DeletedServicesCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DeletedServicesCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DeletedServicesCollectionIterator) Response() DeletedServicesCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DeletedServicesCollectionIterator) Value() DeletedServiceContract { - if !iter.page.NotDone() { - return DeletedServiceContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DeletedServicesCollectionIterator type. -func NewDeletedServicesCollectionIterator(page DeletedServicesCollectionPage) DeletedServicesCollectionIterator { - return DeletedServicesCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dsc DeletedServicesCollection) IsEmpty() bool { - return dsc.Value == nil || len(*dsc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dsc DeletedServicesCollection) hasNextLink() bool { - return dsc.NextLink != nil && len(*dsc.NextLink) != 0 -} - -// deletedServicesCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dsc DeletedServicesCollection) deletedServicesCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !dsc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dsc.NextLink))) -} - -// DeletedServicesCollectionPage contains a page of DeletedServiceContract values. -type DeletedServicesCollectionPage struct { - fn func(context.Context, DeletedServicesCollection) (DeletedServicesCollection, error) - dsc DeletedServicesCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DeletedServicesCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeletedServicesCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dsc) - if err != nil { - return err - } - page.dsc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DeletedServicesCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DeletedServicesCollectionPage) NotDone() bool { - return !page.dsc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DeletedServicesCollectionPage) Response() DeletedServicesCollection { - return page.dsc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DeletedServicesCollectionPage) Values() []DeletedServiceContract { - if page.dsc.IsEmpty() { - return nil - } - return *page.dsc.Value -} - -// Creates a new instance of the DeletedServicesCollectionPage type. -func NewDeletedServicesCollectionPage(cur DeletedServicesCollection, getNextPage func(context.Context, DeletedServicesCollection) (DeletedServicesCollection, error)) DeletedServicesCollectionPage { - return DeletedServicesCollectionPage{ - fn: getNextPage, - dsc: cur, - } -} - -// DeletedServicesPurgeFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DeletedServicesPurgeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DeletedServicesClient) (DeletedServiceContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeletedServicesPurgeFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeletedServicesPurgeFuture.Result. -func (future *DeletedServicesPurgeFuture) result(client DeletedServicesClient) (dsc DeletedServiceContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DeletedServicesPurgeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dsc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.DeletedServicesPurgeFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dsc.Response.Response, err = future.GetResult(sender); err == nil && dsc.Response.Response.StatusCode != http.StatusNoContent { - dsc, err = client.PurgeResponder(dsc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DeletedServicesPurgeFuture", "Result", dsc.Response.Response, "Failure responding to request") - } - } - return -} - -// DeployConfigurationParameterProperties parameters supplied to the Deploy Configuration operation. -type DeployConfigurationParameterProperties struct { - // Branch - The name of the Git branch from which the configuration is to be deployed to the configuration database. - Branch *string `json:"branch,omitempty"` - // Force - The value enforcing deleting subscriptions to products that are deleted in this update. - Force *bool `json:"force,omitempty"` -} - -// DeployConfigurationParameters deploy Tenant Configuration Contract. -type DeployConfigurationParameters struct { - // DeployConfigurationParameterProperties - Deploy Configuration Parameter contract properties. - *DeployConfigurationParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeployConfigurationParameters. -func (dcp DeployConfigurationParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcp.DeployConfigurationParameterProperties != nil { - objectMap["properties"] = dcp.DeployConfigurationParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DeployConfigurationParameters struct. -func (dcp *DeployConfigurationParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var deployConfigurationParameterProperties DeployConfigurationParameterProperties - err = json.Unmarshal(*v, &deployConfigurationParameterProperties) - if err != nil { - return err - } - dcp.DeployConfigurationParameterProperties = &deployConfigurationParameterProperties - } - } - } - - return nil -} - -// DiagnosticCollection paged Diagnostic list representation. -type DiagnosticCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]DiagnosticContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// DiagnosticCollectionIterator provides access to a complete listing of DiagnosticContract values. -type DiagnosticCollectionIterator struct { - i int - page DiagnosticCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DiagnosticCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DiagnosticCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DiagnosticCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DiagnosticCollectionIterator) Response() DiagnosticCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DiagnosticCollectionIterator) Value() DiagnosticContract { - if !iter.page.NotDone() { - return DiagnosticContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DiagnosticCollectionIterator type. -func NewDiagnosticCollectionIterator(page DiagnosticCollectionPage) DiagnosticCollectionIterator { - return DiagnosticCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dc DiagnosticCollection) IsEmpty() bool { - return dc.Value == nil || len(*dc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dc DiagnosticCollection) hasNextLink() bool { - return dc.NextLink != nil && len(*dc.NextLink) != 0 -} - -// diagnosticCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dc DiagnosticCollection) diagnosticCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !dc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dc.NextLink))) -} - -// DiagnosticCollectionPage contains a page of DiagnosticContract values. -type DiagnosticCollectionPage struct { - fn func(context.Context, DiagnosticCollection) (DiagnosticCollection, error) - dc DiagnosticCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DiagnosticCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dc) - if err != nil { - return err - } - page.dc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DiagnosticCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DiagnosticCollectionPage) NotDone() bool { - return !page.dc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DiagnosticCollectionPage) Response() DiagnosticCollection { - return page.dc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DiagnosticCollectionPage) Values() []DiagnosticContract { - if page.dc.IsEmpty() { - return nil - } - return *page.dc.Value -} - -// Creates a new instance of the DiagnosticCollectionPage type. -func NewDiagnosticCollectionPage(cur DiagnosticCollection, getNextPage func(context.Context, DiagnosticCollection) (DiagnosticCollection, error)) DiagnosticCollectionPage { - return DiagnosticCollectionPage{ - fn: getNextPage, - dc: cur, - } -} - -// DiagnosticContract diagnostic details. -type DiagnosticContract struct { - autorest.Response `json:"-"` - // DiagnosticContractProperties - Diagnostic entity contract properties. - *DiagnosticContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DiagnosticContract. -func (dc DiagnosticContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dc.DiagnosticContractProperties != nil { - objectMap["properties"] = dc.DiagnosticContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticContract struct. -func (dc *DiagnosticContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var diagnosticContractProperties DiagnosticContractProperties - err = json.Unmarshal(*v, &diagnosticContractProperties) - if err != nil { - return err - } - dc.DiagnosticContractProperties = &diagnosticContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dc.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticContractProperties diagnostic Entity Properties -type DiagnosticContractProperties struct { - // AlwaysLog - Specifies for what type of messages sampling settings should not apply. Possible values include: 'AlwaysLogAllErrors' - AlwaysLog AlwaysLog `json:"alwaysLog,omitempty"` - // LoggerID - Resource Id of a target logger. - LoggerID *string `json:"loggerId,omitempty"` - // Sampling - Sampling settings for Diagnostic. - Sampling *SamplingSettings `json:"sampling,omitempty"` - // Frontend - Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. - Frontend *PipelineDiagnosticSettings `json:"frontend,omitempty"` - // Backend - Diagnostic settings for incoming/outgoing HTTP messages to the Backend - Backend *PipelineDiagnosticSettings `json:"backend,omitempty"` - // LogClientIP - Log the ClientIP. Default is false. - LogClientIP *bool `json:"logClientIp,omitempty"` - // HTTPCorrelationProtocol - Sets correlation protocol to use for Application Insights diagnostics. Possible values include: 'HTTPCorrelationProtocolNone', 'HTTPCorrelationProtocolLegacy', 'HTTPCorrelationProtocolW3C' - HTTPCorrelationProtocol HTTPCorrelationProtocol `json:"httpCorrelationProtocol,omitempty"` - // Verbosity - The verbosity level applied to traces emitted by trace policies. Possible values include: 'VerbosityVerbose', 'VerbosityInformation', 'VerbosityError' - Verbosity Verbosity `json:"verbosity,omitempty"` - // OperationNameFormat - The format of the Operation Name for Application Insights telemetries. Default is Name. Possible values include: 'OperationNameFormatName', 'OperationNameFormatURL' - OperationNameFormat OperationNameFormat `json:"operationNameFormat,omitempty"` -} - -// EmailTemplateCollection paged email template list representation. -type EmailTemplateCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]EmailTemplateContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// EmailTemplateCollectionIterator provides access to a complete listing of EmailTemplateContract values. -type EmailTemplateCollectionIterator struct { - i int - page EmailTemplateCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *EmailTemplateCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *EmailTemplateCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EmailTemplateCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter EmailTemplateCollectionIterator) Response() EmailTemplateCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter EmailTemplateCollectionIterator) Value() EmailTemplateContract { - if !iter.page.NotDone() { - return EmailTemplateContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EmailTemplateCollectionIterator type. -func NewEmailTemplateCollectionIterator(page EmailTemplateCollectionPage) EmailTemplateCollectionIterator { - return EmailTemplateCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (etc EmailTemplateCollection) IsEmpty() bool { - return etc.Value == nil || len(*etc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (etc EmailTemplateCollection) hasNextLink() bool { - return etc.NextLink != nil && len(*etc.NextLink) != 0 -} - -// emailTemplateCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (etc EmailTemplateCollection) emailTemplateCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !etc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(etc.NextLink))) -} - -// EmailTemplateCollectionPage contains a page of EmailTemplateContract values. -type EmailTemplateCollectionPage struct { - fn func(context.Context, EmailTemplateCollection) (EmailTemplateCollection, error) - etc EmailTemplateCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *EmailTemplateCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.etc) - if err != nil { - return err - } - page.etc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *EmailTemplateCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EmailTemplateCollectionPage) NotDone() bool { - return !page.etc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EmailTemplateCollectionPage) Response() EmailTemplateCollection { - return page.etc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EmailTemplateCollectionPage) Values() []EmailTemplateContract { - if page.etc.IsEmpty() { - return nil - } - return *page.etc.Value -} - -// Creates a new instance of the EmailTemplateCollectionPage type. -func NewEmailTemplateCollectionPage(cur EmailTemplateCollection, getNextPage func(context.Context, EmailTemplateCollection) (EmailTemplateCollection, error)) EmailTemplateCollectionPage { - return EmailTemplateCollectionPage{ - fn: getNextPage, - etc: cur, - } -} - -// EmailTemplateContract email Template details. -type EmailTemplateContract struct { - autorest.Response `json:"-"` - // EmailTemplateContractProperties - Email Template entity contract properties. - *EmailTemplateContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailTemplateContract. -func (etc EmailTemplateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if etc.EmailTemplateContractProperties != nil { - objectMap["properties"] = etc.EmailTemplateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EmailTemplateContract struct. -func (etc *EmailTemplateContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var emailTemplateContractProperties EmailTemplateContractProperties - err = json.Unmarshal(*v, &emailTemplateContractProperties) - if err != nil { - return err - } - etc.EmailTemplateContractProperties = &emailTemplateContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - etc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - etc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - etc.Type = &typeVar - } - } - } - - return nil -} - -// EmailTemplateContractProperties email Template Contract properties. -type EmailTemplateContractProperties struct { - // Subject - Subject of the Template. - Subject *string `json:"subject,omitempty"` - // Body - Email Template Body. This should be a valid XDocument - Body *string `json:"body,omitempty"` - // Title - Title of the Template. - Title *string `json:"title,omitempty"` - // Description - Description of the Email Template. - Description *string `json:"description,omitempty"` - // IsDefault - READ-ONLY; Whether the template is the default template provided by API Management or has been edited. - IsDefault *bool `json:"isDefault,omitempty"` - // Parameters - Email Template Parameter values. - Parameters *[]EmailTemplateParametersContractProperties `json:"parameters,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailTemplateContractProperties. -func (etcp EmailTemplateContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if etcp.Subject != nil { - objectMap["subject"] = etcp.Subject - } - if etcp.Body != nil { - objectMap["body"] = etcp.Body - } - if etcp.Title != nil { - objectMap["title"] = etcp.Title - } - if etcp.Description != nil { - objectMap["description"] = etcp.Description - } - if etcp.Parameters != nil { - objectMap["parameters"] = etcp.Parameters - } - return json.Marshal(objectMap) -} - -// EmailTemplateParametersContractProperties email Template Parameter contract. -type EmailTemplateParametersContractProperties struct { - // Name - Template parameter name. - Name *string `json:"name,omitempty"` - // Title - Template parameter title. - Title *string `json:"title,omitempty"` - // Description - Template parameter description. - Description *string `json:"description,omitempty"` -} - -// EmailTemplateUpdateParameterProperties email Template Update Contract properties. -type EmailTemplateUpdateParameterProperties struct { - // Subject - Subject of the Template. - Subject *string `json:"subject,omitempty"` - // Title - Title of the Template. - Title *string `json:"title,omitempty"` - // Description - Description of the Email Template. - Description *string `json:"description,omitempty"` - // Body - Email Template Body. This should be a valid XDocument - Body *string `json:"body,omitempty"` - // Parameters - Email Template Parameter values. - Parameters *[]EmailTemplateParametersContractProperties `json:"parameters,omitempty"` -} - -// EmailTemplateUpdateParameters email Template update Parameters. -type EmailTemplateUpdateParameters struct { - // EmailTemplateUpdateParameterProperties - Email Template Update contract properties. - *EmailTemplateUpdateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailTemplateUpdateParameters. -func (etup EmailTemplateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if etup.EmailTemplateUpdateParameterProperties != nil { - objectMap["properties"] = etup.EmailTemplateUpdateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EmailTemplateUpdateParameters struct. -func (etup *EmailTemplateUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var emailTemplateUpdateParameterProperties EmailTemplateUpdateParameterProperties - err = json.Unmarshal(*v, &emailTemplateUpdateParameterProperties) - if err != nil { - return err - } - etup.EmailTemplateUpdateParameterProperties = &emailTemplateUpdateParameterProperties - } - } - } - - return nil -} - -// EndpointDependency a domain name that a service is reached at. -type EndpointDependency struct { - // DomainName - The domain name of the dependency. - DomainName *string `json:"domainName,omitempty"` - // EndpointDetails - The Ports used when connecting to DomainName. - EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` -} - -// EndpointDetail current TCP connectivity information from the Api Management Service to a single -// endpoint. -type EndpointDetail struct { - // Port - The port an endpoint is connected to. - Port *int32 `json:"port,omitempty"` - // Region - The region of the dependency. - Region *string `json:"region,omitempty"` -} - -// ErrorFieldContract error Field contract. -type ErrorFieldContract struct { - // Code - Property level error code. - Code *string `json:"code,omitempty"` - // Message - Human-readable representation of property-level error. - Message *string `json:"message,omitempty"` - // Target - Property name. - Target *string `json:"target,omitempty"` -} - -// ErrorResponse error Response. -type ErrorResponse struct { - // ErrorResponseBody - Properties of the Error Response. - *ErrorResponseBody `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponse. -func (er ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if er.ErrorResponseBody != nil { - objectMap["error"] = er.ErrorResponseBody - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ErrorResponse struct. -func (er *ErrorResponse) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "error": - if v != nil { - var errorResponseBody ErrorResponseBody - err = json.Unmarshal(*v, &errorResponseBody) - if err != nil { - return err - } - er.ErrorResponseBody = &errorResponseBody - } - } - } - - return nil -} - -// ErrorResponseBody error Body contract. -type ErrorResponseBody struct { - // Code - Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. - Code *string `json:"code,omitempty"` - // Message - Human-readable representation of the error. - Message *string `json:"message,omitempty"` - // Details - The list of invalid fields send in request, in case of validation error. - Details *[]ErrorFieldContract `json:"details,omitempty"` -} - -// GatewayCertificateAuthorityCollection paged Gateway certificate authority list representation. -type GatewayCertificateAuthorityCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]GatewayCertificateAuthorityContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayCertificateAuthorityCollection. -func (gcac GatewayCertificateAuthorityCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GatewayCertificateAuthorityCollectionIterator provides access to a complete listing of -// GatewayCertificateAuthorityContract values. -type GatewayCertificateAuthorityCollectionIterator struct { - i int - page GatewayCertificateAuthorityCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *GatewayCertificateAuthorityCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCertificateAuthorityCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *GatewayCertificateAuthorityCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GatewayCertificateAuthorityCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter GatewayCertificateAuthorityCollectionIterator) Response() GatewayCertificateAuthorityCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter GatewayCertificateAuthorityCollectionIterator) Value() GatewayCertificateAuthorityContract { - if !iter.page.NotDone() { - return GatewayCertificateAuthorityContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GatewayCertificateAuthorityCollectionIterator type. -func NewGatewayCertificateAuthorityCollectionIterator(page GatewayCertificateAuthorityCollectionPage) GatewayCertificateAuthorityCollectionIterator { - return GatewayCertificateAuthorityCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (gcac GatewayCertificateAuthorityCollection) IsEmpty() bool { - return gcac.Value == nil || len(*gcac.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (gcac GatewayCertificateAuthorityCollection) hasNextLink() bool { - return gcac.NextLink != nil && len(*gcac.NextLink) != 0 -} - -// gatewayCertificateAuthorityCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (gcac GatewayCertificateAuthorityCollection) gatewayCertificateAuthorityCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !gcac.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(gcac.NextLink))) -} - -// GatewayCertificateAuthorityCollectionPage contains a page of GatewayCertificateAuthorityContract values. -type GatewayCertificateAuthorityCollectionPage struct { - fn func(context.Context, GatewayCertificateAuthorityCollection) (GatewayCertificateAuthorityCollection, error) - gcac GatewayCertificateAuthorityCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *GatewayCertificateAuthorityCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCertificateAuthorityCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.gcac) - if err != nil { - return err - } - page.gcac = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *GatewayCertificateAuthorityCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GatewayCertificateAuthorityCollectionPage) NotDone() bool { - return !page.gcac.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GatewayCertificateAuthorityCollectionPage) Response() GatewayCertificateAuthorityCollection { - return page.gcac -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GatewayCertificateAuthorityCollectionPage) Values() []GatewayCertificateAuthorityContract { - if page.gcac.IsEmpty() { - return nil - } - return *page.gcac.Value -} - -// Creates a new instance of the GatewayCertificateAuthorityCollectionPage type. -func NewGatewayCertificateAuthorityCollectionPage(cur GatewayCertificateAuthorityCollection, getNextPage func(context.Context, GatewayCertificateAuthorityCollection) (GatewayCertificateAuthorityCollection, error)) GatewayCertificateAuthorityCollectionPage { - return GatewayCertificateAuthorityCollectionPage{ - fn: getNextPage, - gcac: cur, - } -} - -// GatewayCertificateAuthorityContract gateway certificate authority details. -type GatewayCertificateAuthorityContract struct { - autorest.Response `json:"-"` - // GatewayCertificateAuthorityContractProperties - Gateway certificate authority details. - *GatewayCertificateAuthorityContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayCertificateAuthorityContract. -func (gcac GatewayCertificateAuthorityContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gcac.GatewayCertificateAuthorityContractProperties != nil { - objectMap["properties"] = gcac.GatewayCertificateAuthorityContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GatewayCertificateAuthorityContract struct. -func (gcac *GatewayCertificateAuthorityContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var gatewayCertificateAuthorityContractProperties GatewayCertificateAuthorityContractProperties - err = json.Unmarshal(*v, &gatewayCertificateAuthorityContractProperties) - if err != nil { - return err - } - gcac.GatewayCertificateAuthorityContractProperties = &gatewayCertificateAuthorityContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gcac.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gcac.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gcac.Type = &typeVar - } - } - } - - return nil -} - -// GatewayCertificateAuthorityContractProperties gateway certificate authority details. -type GatewayCertificateAuthorityContractProperties struct { - // IsTrusted - Determines whether certificate authority is trusted. - IsTrusted *bool `json:"isTrusted,omitempty"` -} - -// GatewayCollection paged Gateway list representation. -type GatewayCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]GatewayContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayCollection. -func (gc GatewayCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gc.Count != nil { - objectMap["count"] = gc.Count - } - return json.Marshal(objectMap) -} - -// GatewayCollectionIterator provides access to a complete listing of GatewayContract values. -type GatewayCollectionIterator struct { - i int - page GatewayCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *GatewayCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *GatewayCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GatewayCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter GatewayCollectionIterator) Response() GatewayCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter GatewayCollectionIterator) Value() GatewayContract { - if !iter.page.NotDone() { - return GatewayContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GatewayCollectionIterator type. -func NewGatewayCollectionIterator(page GatewayCollectionPage) GatewayCollectionIterator { - return GatewayCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (gc GatewayCollection) IsEmpty() bool { - return gc.Value == nil || len(*gc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (gc GatewayCollection) hasNextLink() bool { - return gc.NextLink != nil && len(*gc.NextLink) != 0 -} - -// gatewayCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (gc GatewayCollection) gatewayCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !gc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(gc.NextLink))) -} - -// GatewayCollectionPage contains a page of GatewayContract values. -type GatewayCollectionPage struct { - fn func(context.Context, GatewayCollection) (GatewayCollection, error) - gc GatewayCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *GatewayCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.gc) - if err != nil { - return err - } - page.gc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *GatewayCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GatewayCollectionPage) NotDone() bool { - return !page.gc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GatewayCollectionPage) Response() GatewayCollection { - return page.gc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GatewayCollectionPage) Values() []GatewayContract { - if page.gc.IsEmpty() { - return nil - } - return *page.gc.Value -} - -// Creates a new instance of the GatewayCollectionPage type. -func NewGatewayCollectionPage(cur GatewayCollection, getNextPage func(context.Context, GatewayCollection) (GatewayCollection, error)) GatewayCollectionPage { - return GatewayCollectionPage{ - fn: getNextPage, - gc: cur, - } -} - -// GatewayContract gateway details. -type GatewayContract struct { - autorest.Response `json:"-"` - // GatewayContractProperties - Gateway details. - *GatewayContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayContract. -func (gc GatewayContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gc.GatewayContractProperties != nil { - objectMap["properties"] = gc.GatewayContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GatewayContract struct. -func (gc *GatewayContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var gatewayContractProperties GatewayContractProperties - err = json.Unmarshal(*v, &gatewayContractProperties) - if err != nil { - return err - } - gc.GatewayContractProperties = &gatewayContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gc.Type = &typeVar - } - } - } - - return nil -} - -// GatewayContractProperties properties of the Gateway contract. -type GatewayContractProperties struct { - // LocationData - Gateway location. - LocationData *ResourceLocationDataContract `json:"locationData,omitempty"` - // Description - Gateway description - Description *string `json:"description,omitempty"` -} - -// GatewayHostnameConfigurationCollection paged Gateway hostname configuration list representation. -type GatewayHostnameConfigurationCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]GatewayHostnameConfigurationContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayHostnameConfigurationCollection. -func (ghcc GatewayHostnameConfigurationCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GatewayHostnameConfigurationCollectionIterator provides access to a complete listing of -// GatewayHostnameConfigurationContract values. -type GatewayHostnameConfigurationCollectionIterator struct { - i int - page GatewayHostnameConfigurationCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *GatewayHostnameConfigurationCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *GatewayHostnameConfigurationCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GatewayHostnameConfigurationCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter GatewayHostnameConfigurationCollectionIterator) Response() GatewayHostnameConfigurationCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter GatewayHostnameConfigurationCollectionIterator) Value() GatewayHostnameConfigurationContract { - if !iter.page.NotDone() { - return GatewayHostnameConfigurationContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GatewayHostnameConfigurationCollectionIterator type. -func NewGatewayHostnameConfigurationCollectionIterator(page GatewayHostnameConfigurationCollectionPage) GatewayHostnameConfigurationCollectionIterator { - return GatewayHostnameConfigurationCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ghcc GatewayHostnameConfigurationCollection) IsEmpty() bool { - return ghcc.Value == nil || len(*ghcc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ghcc GatewayHostnameConfigurationCollection) hasNextLink() bool { - return ghcc.NextLink != nil && len(*ghcc.NextLink) != 0 -} - -// gatewayHostnameConfigurationCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ghcc GatewayHostnameConfigurationCollection) gatewayHostnameConfigurationCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !ghcc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ghcc.NextLink))) -} - -// GatewayHostnameConfigurationCollectionPage contains a page of GatewayHostnameConfigurationContract -// values. -type GatewayHostnameConfigurationCollectionPage struct { - fn func(context.Context, GatewayHostnameConfigurationCollection) (GatewayHostnameConfigurationCollection, error) - ghcc GatewayHostnameConfigurationCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *GatewayHostnameConfigurationCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ghcc) - if err != nil { - return err - } - page.ghcc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *GatewayHostnameConfigurationCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GatewayHostnameConfigurationCollectionPage) NotDone() bool { - return !page.ghcc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GatewayHostnameConfigurationCollectionPage) Response() GatewayHostnameConfigurationCollection { - return page.ghcc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GatewayHostnameConfigurationCollectionPage) Values() []GatewayHostnameConfigurationContract { - if page.ghcc.IsEmpty() { - return nil - } - return *page.ghcc.Value -} - -// Creates a new instance of the GatewayHostnameConfigurationCollectionPage type. -func NewGatewayHostnameConfigurationCollectionPage(cur GatewayHostnameConfigurationCollection, getNextPage func(context.Context, GatewayHostnameConfigurationCollection) (GatewayHostnameConfigurationCollection, error)) GatewayHostnameConfigurationCollectionPage { - return GatewayHostnameConfigurationCollectionPage{ - fn: getNextPage, - ghcc: cur, - } -} - -// GatewayHostnameConfigurationContract gateway hostname configuration details. -type GatewayHostnameConfigurationContract struct { - autorest.Response `json:"-"` - // GatewayHostnameConfigurationContractProperties - Gateway hostname configuration details. - *GatewayHostnameConfigurationContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayHostnameConfigurationContract. -func (ghcc GatewayHostnameConfigurationContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ghcc.GatewayHostnameConfigurationContractProperties != nil { - objectMap["properties"] = ghcc.GatewayHostnameConfigurationContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GatewayHostnameConfigurationContract struct. -func (ghcc *GatewayHostnameConfigurationContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var gatewayHostnameConfigurationContractProperties GatewayHostnameConfigurationContractProperties - err = json.Unmarshal(*v, &gatewayHostnameConfigurationContractProperties) - if err != nil { - return err - } - ghcc.GatewayHostnameConfigurationContractProperties = &gatewayHostnameConfigurationContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ghcc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ghcc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ghcc.Type = &typeVar - } - } - } - - return nil -} - -// GatewayHostnameConfigurationContractProperties gateway hostname configuration details. -type GatewayHostnameConfigurationContractProperties struct { - // Hostname - Hostname value. Supports valid domain name, partial or full wildcard - Hostname *string `json:"hostname,omitempty"` - // CertificateID - Identifier of Certificate entity that will be used for TLS connection establishment - CertificateID *string `json:"certificateId,omitempty"` - // NegotiateClientCertificate - Determines whether gateway requests client certificate - NegotiateClientCertificate *bool `json:"negotiateClientCertificate,omitempty"` - // TLS10Enabled - Specifies if TLS 1.0 is supported - TLS10Enabled *bool `json:"tls10Enabled,omitempty"` - // TLS11Enabled - Specifies if TLS 1.1 is supported - TLS11Enabled *bool `json:"tls11Enabled,omitempty"` - // HTTP2Enabled - Specifies if HTTP/2.0 is supported - HTTP2Enabled *bool `json:"http2Enabled,omitempty"` -} - -// GatewayKeyRegenerationRequestContract gateway key regeneration request contract properties. -type GatewayKeyRegenerationRequestContract struct { - // KeyType - The Key being regenerated. Possible values include: 'KeyTypePrimary', 'KeyTypeSecondary' - KeyType KeyType `json:"keyType,omitempty"` -} - -// GatewayKeysContract gateway authentication keys. -type GatewayKeysContract struct { - autorest.Response `json:"-"` - // Primary - Primary gateway key. - Primary *string `json:"primary,omitempty"` - // Secondary - Secondary gateway key. - Secondary *string `json:"secondary,omitempty"` -} - -// GatewayTokenContract gateway access token. -type GatewayTokenContract struct { - autorest.Response `json:"-"` - // Value - Shared Access Authentication token value for the Gateway. - Value *string `json:"value,omitempty"` -} - -// GatewayTokenRequestContract gateway token request contract properties. -type GatewayTokenRequestContract struct { - // KeyType - The Key to be used to generate gateway token. Possible values include: 'KeyTypePrimary', 'KeyTypeSecondary' - KeyType KeyType `json:"keyType,omitempty"` - // Expiry - The Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Expiry *date.Time `json:"expiry,omitempty"` -} - -// GenerateSsoURLResult generate SSO Url operations response details. -type GenerateSsoURLResult struct { - autorest.Response `json:"-"` - // Value - Redirect Url containing the SSO URL value. - Value *string `json:"value,omitempty"` -} - -// GroupCollection paged Group list representation. -type GroupCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]GroupContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// GroupCollectionIterator provides access to a complete listing of GroupContract values. -type GroupCollectionIterator struct { - i int - page GroupCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *GroupCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *GroupCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GroupCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter GroupCollectionIterator) Response() GroupCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter GroupCollectionIterator) Value() GroupContract { - if !iter.page.NotDone() { - return GroupContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GroupCollectionIterator type. -func NewGroupCollectionIterator(page GroupCollectionPage) GroupCollectionIterator { - return GroupCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (gc GroupCollection) IsEmpty() bool { - return gc.Value == nil || len(*gc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (gc GroupCollection) hasNextLink() bool { - return gc.NextLink != nil && len(*gc.NextLink) != 0 -} - -// groupCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (gc GroupCollection) groupCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !gc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(gc.NextLink))) -} - -// GroupCollectionPage contains a page of GroupContract values. -type GroupCollectionPage struct { - fn func(context.Context, GroupCollection) (GroupCollection, error) - gc GroupCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *GroupCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.gc) - if err != nil { - return err - } - page.gc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *GroupCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GroupCollectionPage) NotDone() bool { - return !page.gc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GroupCollectionPage) Response() GroupCollection { - return page.gc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GroupCollectionPage) Values() []GroupContract { - if page.gc.IsEmpty() { - return nil - } - return *page.gc.Value -} - -// Creates a new instance of the GroupCollectionPage type. -func NewGroupCollectionPage(cur GroupCollection, getNextPage func(context.Context, GroupCollection) (GroupCollection, error)) GroupCollectionPage { - return GroupCollectionPage{ - fn: getNextPage, - gc: cur, - } -} - -// GroupContract contract details. -type GroupContract struct { - autorest.Response `json:"-"` - // GroupContractProperties - Group entity contract properties. - *GroupContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupContract. -func (gc GroupContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gc.GroupContractProperties != nil { - objectMap["properties"] = gc.GroupContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GroupContract struct. -func (gc *GroupContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var groupContractProperties GroupContractProperties - err = json.Unmarshal(*v, &groupContractProperties) - if err != nil { - return err - } - gc.GroupContractProperties = &groupContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gc.Type = &typeVar - } - } - } - - return nil -} - -// GroupContractProperties group contract Properties. -type GroupContractProperties struct { - // DisplayName - Group name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Group description. Can contain HTML formatting tags. - Description *string `json:"description,omitempty"` - // BuiltIn - READ-ONLY; true if the group is one of the three system groups (Administrators, Developers, or Guests); otherwise false. - BuiltIn *bool `json:"builtIn,omitempty"` - // Type - Group type. Possible values include: 'GroupTypeCustom', 'GroupTypeSystem', 'GroupTypeExternal' - Type GroupType `json:"type,omitempty"` - // ExternalID - For external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://.onmicrosoft.com/groups/`; otherwise the value is null. - ExternalID *string `json:"externalId,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupContractProperties. -func (gcp GroupContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gcp.DisplayName != nil { - objectMap["displayName"] = gcp.DisplayName - } - if gcp.Description != nil { - objectMap["description"] = gcp.Description - } - if gcp.Type != "" { - objectMap["type"] = gcp.Type - } - if gcp.ExternalID != nil { - objectMap["externalId"] = gcp.ExternalID - } - return json.Marshal(objectMap) -} - -// GroupCreateParameters parameters supplied to the Create Group operation. -type GroupCreateParameters struct { - // GroupCreateParametersProperties - Properties supplied to Create Group operation. - *GroupCreateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupCreateParameters. -func (gcp GroupCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gcp.GroupCreateParametersProperties != nil { - objectMap["properties"] = gcp.GroupCreateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GroupCreateParameters struct. -func (gcp *GroupCreateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var groupCreateParametersProperties GroupCreateParametersProperties - err = json.Unmarshal(*v, &groupCreateParametersProperties) - if err != nil { - return err - } - gcp.GroupCreateParametersProperties = &groupCreateParametersProperties - } - } - } - - return nil -} - -// GroupCreateParametersProperties parameters supplied to the Create Group operation. -type GroupCreateParametersProperties struct { - // DisplayName - Group name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Group description. - Description *string `json:"description,omitempty"` - // Type - Group type. Possible values include: 'GroupTypeCustom', 'GroupTypeSystem', 'GroupTypeExternal' - Type GroupType `json:"type,omitempty"` - // ExternalID - Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://.onmicrosoft.com/groups/`; otherwise the value is null. - ExternalID *string `json:"externalId,omitempty"` -} - -// GroupUpdateParameters parameters supplied to the Update Group operation. -type GroupUpdateParameters struct { - // GroupUpdateParametersProperties - Group entity update contract properties. - *GroupUpdateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupUpdateParameters. -func (gup GroupUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gup.GroupUpdateParametersProperties != nil { - objectMap["properties"] = gup.GroupUpdateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GroupUpdateParameters struct. -func (gup *GroupUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var groupUpdateParametersProperties GroupUpdateParametersProperties - err = json.Unmarshal(*v, &groupUpdateParametersProperties) - if err != nil { - return err - } - gup.GroupUpdateParametersProperties = &groupUpdateParametersProperties - } - } - } - - return nil -} - -// GroupUpdateParametersProperties parameters supplied to the Update Group operation. -type GroupUpdateParametersProperties struct { - // DisplayName - Group name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Group description. - Description *string `json:"description,omitempty"` - // Type - Group type. Possible values include: 'GroupTypeCustom', 'GroupTypeSystem', 'GroupTypeExternal' - Type GroupType `json:"type,omitempty"` - // ExternalID - Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://.onmicrosoft.com/groups/`; otherwise the value is null. - ExternalID *string `json:"externalId,omitempty"` -} - -// HostnameConfiguration custom hostname configuration. -type HostnameConfiguration struct { - // Type - Hostname type. Possible values include: 'HostnameTypeProxy', 'HostnameTypePortal', 'HostnameTypeManagement', 'HostnameTypeScm', 'HostnameTypeDeveloperPortal' - Type HostnameType `json:"type,omitempty"` - // HostName - Hostname to configure on the Api Management service. - HostName *string `json:"hostName,omitempty"` - // KeyVaultID - Url to the KeyVault Secret containing the Ssl Certificate. If absolute Url containing version is provided, auto-update of ssl certificate will not work. This requires Api Management service to be configured with aka.ms/apimmsi. The secret should be of type *application/x-pkcs12* - KeyVaultID *string `json:"keyVaultId,omitempty"` - // IdentityClientID - System or User Assigned Managed identity clientId as generated by Azure AD, which has GET access to the keyVault containing the SSL certificate. - IdentityClientID *string `json:"identityClientId,omitempty"` - // EncodedCertificate - Base64 Encoded certificate. - EncodedCertificate *string `json:"encodedCertificate,omitempty"` - // CertificatePassword - Certificate Password. - CertificatePassword *string `json:"certificatePassword,omitempty"` - // DefaultSslBinding - Specify true to setup the certificate associated with this Hostname as the Default SSL Certificate. If a client does not send the SNI header, then this will be the certificate that will be challenged. The property is useful if a service has multiple custom hostname enabled and it needs to decide on the default ssl certificate. The setting only applied to Proxy Hostname Type. - DefaultSslBinding *bool `json:"defaultSslBinding,omitempty"` - // NegotiateClientCertificate - Specify true to always negotiate client certificate on the hostname. Default Value is false. - NegotiateClientCertificate *bool `json:"negotiateClientCertificate,omitempty"` - // Certificate - Certificate information. - Certificate *CertificateInformation `json:"certificate,omitempty"` - // CertificateSource - Certificate Source. Possible values include: 'CertificateSourceManaged', 'CertificateSourceKeyVault', 'CertificateSourceCustom', 'CertificateSourceBuiltIn' - CertificateSource CertificateSource `json:"certificateSource,omitempty"` - // CertificateStatus - Certificate Status. Possible values include: 'CertificateStatusCompleted', 'CertificateStatusFailed', 'CertificateStatusInProgress' - CertificateStatus CertificateStatus `json:"certificateStatus,omitempty"` -} - -// HTTPHeader HTTP header and it's value. -type HTTPHeader struct { - // Name - Header name. - Name *string `json:"name,omitempty"` - // Value - Header value. - Value *string `json:"value,omitempty"` -} - -// HTTPMessageDiagnostic http message diagnostic settings. -type HTTPMessageDiagnostic struct { - // Headers - Array of HTTP Headers to log. - Headers *[]string `json:"headers,omitempty"` - // Body - Body logging settings. - Body *BodyDiagnosticSettings `json:"body,omitempty"` - // DataMasking - Data masking settings. - DataMasking *DataMasking `json:"dataMasking,omitempty"` -} - -// IdentityProviderBaseParameters identity Provider Base Parameter Properties. -type IdentityProviderBaseParameters struct { - // Type - Identity Provider Type identifier. Possible values include: 'IdentityProviderTypeFacebook', 'IdentityProviderTypeGoogle', 'IdentityProviderTypeMicrosoft', 'IdentityProviderTypeTwitter', 'IdentityProviderTypeAad', 'IdentityProviderTypeAadB2C' - Type IdentityProviderType `json:"type,omitempty"` - // SigninTenant - The TenantId to use instead of Common when logging into Active Directory - SigninTenant *string `json:"signinTenant,omitempty"` - // AllowedTenants - List of Allowed Tenants when configuring Azure Active Directory login. - AllowedTenants *[]string `json:"allowedTenants,omitempty"` - // Authority - OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - Authority *string `json:"authority,omitempty"` - // SignupPolicyName - Signup Policy Name. Only applies to AAD B2C Identity Provider. - SignupPolicyName *string `json:"signupPolicyName,omitempty"` - // SigninPolicyName - Signin Policy Name. Only applies to AAD B2C Identity Provider. - SigninPolicyName *string `json:"signinPolicyName,omitempty"` - // ProfileEditingPolicyName - Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - ProfileEditingPolicyName *string `json:"profileEditingPolicyName,omitempty"` - // PasswordResetPolicyName - Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - PasswordResetPolicyName *string `json:"passwordResetPolicyName,omitempty"` -} - -// IdentityProviderContract identity Provider details. -type IdentityProviderContract struct { - autorest.Response `json:"-"` - // IdentityProviderContractProperties - Identity Provider contract properties. - *IdentityProviderContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IdentityProviderContract. -func (ipc IdentityProviderContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipc.IdentityProviderContractProperties != nil { - objectMap["properties"] = ipc.IdentityProviderContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IdentityProviderContract struct. -func (ipc *IdentityProviderContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var identityProviderContractProperties IdentityProviderContractProperties - err = json.Unmarshal(*v, &identityProviderContractProperties) - if err != nil { - return err - } - ipc.IdentityProviderContractProperties = &identityProviderContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ipc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ipc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ipc.Type = &typeVar - } - } - } - - return nil -} - -// IdentityProviderContractProperties the external Identity Providers like Facebook, Google, Microsoft, -// Twitter or Azure Active Directory which can be used to enable access to the API Management service -// developer portal for all users. -type IdentityProviderContractProperties struct { - // ClientID - Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - ClientSecret *string `json:"clientSecret,omitempty"` - // Type - Identity Provider Type identifier. Possible values include: 'IdentityProviderTypeFacebook', 'IdentityProviderTypeGoogle', 'IdentityProviderTypeMicrosoft', 'IdentityProviderTypeTwitter', 'IdentityProviderTypeAad', 'IdentityProviderTypeAadB2C' - Type IdentityProviderType `json:"type,omitempty"` - // SigninTenant - The TenantId to use instead of Common when logging into Active Directory - SigninTenant *string `json:"signinTenant,omitempty"` - // AllowedTenants - List of Allowed Tenants when configuring Azure Active Directory login. - AllowedTenants *[]string `json:"allowedTenants,omitempty"` - // Authority - OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - Authority *string `json:"authority,omitempty"` - // SignupPolicyName - Signup Policy Name. Only applies to AAD B2C Identity Provider. - SignupPolicyName *string `json:"signupPolicyName,omitempty"` - // SigninPolicyName - Signin Policy Name. Only applies to AAD B2C Identity Provider. - SigninPolicyName *string `json:"signinPolicyName,omitempty"` - // ProfileEditingPolicyName - Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - ProfileEditingPolicyName *string `json:"profileEditingPolicyName,omitempty"` - // PasswordResetPolicyName - Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - PasswordResetPolicyName *string `json:"passwordResetPolicyName,omitempty"` -} - -// IdentityProviderCreateContract identity Provider details. -type IdentityProviderCreateContract struct { - // IdentityProviderCreateContractProperties - Identity Provider contract properties. - *IdentityProviderCreateContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IdentityProviderCreateContract. -func (ipcc IdentityProviderCreateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipcc.IdentityProviderCreateContractProperties != nil { - objectMap["properties"] = ipcc.IdentityProviderCreateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IdentityProviderCreateContract struct. -func (ipcc *IdentityProviderCreateContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var identityProviderCreateContractProperties IdentityProviderCreateContractProperties - err = json.Unmarshal(*v, &identityProviderCreateContractProperties) - if err != nil { - return err - } - ipcc.IdentityProviderCreateContractProperties = &identityProviderCreateContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ipcc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ipcc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ipcc.Type = &typeVar - } - } - } - - return nil -} - -// IdentityProviderCreateContractProperties the external Identity Providers like Facebook, Google, -// Microsoft, Twitter or Azure Active Directory which can be used to enable access to the API Management -// service developer portal for all users. -type IdentityProviderCreateContractProperties struct { - // ClientID - Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - ClientSecret *string `json:"clientSecret,omitempty"` - // Type - Identity Provider Type identifier. Possible values include: 'IdentityProviderTypeFacebook', 'IdentityProviderTypeGoogle', 'IdentityProviderTypeMicrosoft', 'IdentityProviderTypeTwitter', 'IdentityProviderTypeAad', 'IdentityProviderTypeAadB2C' - Type IdentityProviderType `json:"type,omitempty"` - // SigninTenant - The TenantId to use instead of Common when logging into Active Directory - SigninTenant *string `json:"signinTenant,omitempty"` - // AllowedTenants - List of Allowed Tenants when configuring Azure Active Directory login. - AllowedTenants *[]string `json:"allowedTenants,omitempty"` - // Authority - OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - Authority *string `json:"authority,omitempty"` - // SignupPolicyName - Signup Policy Name. Only applies to AAD B2C Identity Provider. - SignupPolicyName *string `json:"signupPolicyName,omitempty"` - // SigninPolicyName - Signin Policy Name. Only applies to AAD B2C Identity Provider. - SigninPolicyName *string `json:"signinPolicyName,omitempty"` - // ProfileEditingPolicyName - Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - ProfileEditingPolicyName *string `json:"profileEditingPolicyName,omitempty"` - // PasswordResetPolicyName - Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - PasswordResetPolicyName *string `json:"passwordResetPolicyName,omitempty"` -} - -// IdentityProviderList list of all the Identity Providers configured on the service instance. -type IdentityProviderList struct { - autorest.Response `json:"-"` - // Value - Identity Provider configuration values. - Value *[]IdentityProviderContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// IdentityProviderListIterator provides access to a complete listing of IdentityProviderContract values. -type IdentityProviderListIterator struct { - i int - page IdentityProviderListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IdentityProviderListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IdentityProviderListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IdentityProviderListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IdentityProviderListIterator) Response() IdentityProviderList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IdentityProviderListIterator) Value() IdentityProviderContract { - if !iter.page.NotDone() { - return IdentityProviderContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IdentityProviderListIterator type. -func NewIdentityProviderListIterator(page IdentityProviderListPage) IdentityProviderListIterator { - return IdentityProviderListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ipl IdentityProviderList) IsEmpty() bool { - return ipl.Value == nil || len(*ipl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ipl IdentityProviderList) hasNextLink() bool { - return ipl.NextLink != nil && len(*ipl.NextLink) != 0 -} - -// identityProviderListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ipl IdentityProviderList) identityProviderListPreparer(ctx context.Context) (*http.Request, error) { - if !ipl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ipl.NextLink))) -} - -// IdentityProviderListPage contains a page of IdentityProviderContract values. -type IdentityProviderListPage struct { - fn func(context.Context, IdentityProviderList) (IdentityProviderList, error) - ipl IdentityProviderList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IdentityProviderListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ipl) - if err != nil { - return err - } - page.ipl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IdentityProviderListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IdentityProviderListPage) NotDone() bool { - return !page.ipl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IdentityProviderListPage) Response() IdentityProviderList { - return page.ipl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IdentityProviderListPage) Values() []IdentityProviderContract { - if page.ipl.IsEmpty() { - return nil - } - return *page.ipl.Value -} - -// Creates a new instance of the IdentityProviderListPage type. -func NewIdentityProviderListPage(cur IdentityProviderList, getNextPage func(context.Context, IdentityProviderList) (IdentityProviderList, error)) IdentityProviderListPage { - return IdentityProviderListPage{ - fn: getNextPage, - ipl: cur, - } -} - -// IdentityProviderUpdateParameters parameters supplied to update Identity Provider -type IdentityProviderUpdateParameters struct { - // IdentityProviderUpdateProperties - Identity Provider update properties. - *IdentityProviderUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for IdentityProviderUpdateParameters. -func (ipup IdentityProviderUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipup.IdentityProviderUpdateProperties != nil { - objectMap["properties"] = ipup.IdentityProviderUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IdentityProviderUpdateParameters struct. -func (ipup *IdentityProviderUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var identityProviderUpdateProperties IdentityProviderUpdateProperties - err = json.Unmarshal(*v, &identityProviderUpdateProperties) - if err != nil { - return err - } - ipup.IdentityProviderUpdateProperties = &identityProviderUpdateProperties - } - } - } - - return nil -} - -// IdentityProviderUpdateProperties parameters supplied to the Update Identity Provider operation. -type IdentityProviderUpdateProperties struct { - // ClientID - Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. - ClientSecret *string `json:"clientSecret,omitempty"` - // Type - Identity Provider Type identifier. Possible values include: 'IdentityProviderTypeFacebook', 'IdentityProviderTypeGoogle', 'IdentityProviderTypeMicrosoft', 'IdentityProviderTypeTwitter', 'IdentityProviderTypeAad', 'IdentityProviderTypeAadB2C' - Type IdentityProviderType `json:"type,omitempty"` - // SigninTenant - The TenantId to use instead of Common when logging into Active Directory - SigninTenant *string `json:"signinTenant,omitempty"` - // AllowedTenants - List of Allowed Tenants when configuring Azure Active Directory login. - AllowedTenants *[]string `json:"allowedTenants,omitempty"` - // Authority - OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - Authority *string `json:"authority,omitempty"` - // SignupPolicyName - Signup Policy Name. Only applies to AAD B2C Identity Provider. - SignupPolicyName *string `json:"signupPolicyName,omitempty"` - // SigninPolicyName - Signin Policy Name. Only applies to AAD B2C Identity Provider. - SigninPolicyName *string `json:"signinPolicyName,omitempty"` - // ProfileEditingPolicyName - Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - ProfileEditingPolicyName *string `json:"profileEditingPolicyName,omitempty"` - // PasswordResetPolicyName - Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - PasswordResetPolicyName *string `json:"passwordResetPolicyName,omitempty"` -} - -// IssueAttachmentCollection paged Issue Attachment list representation. -type IssueAttachmentCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Issue Attachment values. - Value *[]IssueAttachmentContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueAttachmentCollection. -func (iac IssueAttachmentCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iac.Count != nil { - objectMap["count"] = iac.Count - } - return json.Marshal(objectMap) -} - -// IssueAttachmentCollectionIterator provides access to a complete listing of IssueAttachmentContract -// values. -type IssueAttachmentCollectionIterator struct { - i int - page IssueAttachmentCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IssueAttachmentCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueAttachmentCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IssueAttachmentCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IssueAttachmentCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IssueAttachmentCollectionIterator) Response() IssueAttachmentCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IssueAttachmentCollectionIterator) Value() IssueAttachmentContract { - if !iter.page.NotDone() { - return IssueAttachmentContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IssueAttachmentCollectionIterator type. -func NewIssueAttachmentCollectionIterator(page IssueAttachmentCollectionPage) IssueAttachmentCollectionIterator { - return IssueAttachmentCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iac IssueAttachmentCollection) IsEmpty() bool { - return iac.Value == nil || len(*iac.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iac IssueAttachmentCollection) hasNextLink() bool { - return iac.NextLink != nil && len(*iac.NextLink) != 0 -} - -// issueAttachmentCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iac IssueAttachmentCollection) issueAttachmentCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !iac.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iac.NextLink))) -} - -// IssueAttachmentCollectionPage contains a page of IssueAttachmentContract values. -type IssueAttachmentCollectionPage struct { - fn func(context.Context, IssueAttachmentCollection) (IssueAttachmentCollection, error) - iac IssueAttachmentCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IssueAttachmentCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueAttachmentCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.iac) - if err != nil { - return err - } - page.iac = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IssueAttachmentCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IssueAttachmentCollectionPage) NotDone() bool { - return !page.iac.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IssueAttachmentCollectionPage) Response() IssueAttachmentCollection { - return page.iac -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IssueAttachmentCollectionPage) Values() []IssueAttachmentContract { - if page.iac.IsEmpty() { - return nil - } - return *page.iac.Value -} - -// Creates a new instance of the IssueAttachmentCollectionPage type. -func NewIssueAttachmentCollectionPage(cur IssueAttachmentCollection, getNextPage func(context.Context, IssueAttachmentCollection) (IssueAttachmentCollection, error)) IssueAttachmentCollectionPage { - return IssueAttachmentCollectionPage{ - fn: getNextPage, - iac: cur, - } -} - -// IssueAttachmentContract issue Attachment Contract details. -type IssueAttachmentContract struct { - autorest.Response `json:"-"` - // IssueAttachmentContractProperties - Properties of the Issue Attachment. - *IssueAttachmentContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueAttachmentContract. -func (iac IssueAttachmentContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iac.IssueAttachmentContractProperties != nil { - objectMap["properties"] = iac.IssueAttachmentContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IssueAttachmentContract struct. -func (iac *IssueAttachmentContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var issueAttachmentContractProperties IssueAttachmentContractProperties - err = json.Unmarshal(*v, &issueAttachmentContractProperties) - if err != nil { - return err - } - iac.IssueAttachmentContractProperties = &issueAttachmentContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - iac.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - iac.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - iac.Type = &typeVar - } - } - } - - return nil -} - -// IssueAttachmentContractProperties issue Attachment contract Properties. -type IssueAttachmentContractProperties struct { - // Title - Filename by which the binary data will be saved. - Title *string `json:"title,omitempty"` - // ContentFormat - Either 'link' if content is provided via an HTTP link or the MIME type of the Base64-encoded binary data provided in the 'content' property. - ContentFormat *string `json:"contentFormat,omitempty"` - // Content - An HTTP link or Base64-encoded binary data. - Content *string `json:"content,omitempty"` -} - -// IssueCollection paged Issue list representation. -type IssueCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Issue values. - Value *[]IssueContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueCollection. -func (ic IssueCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ic.Count != nil { - objectMap["count"] = ic.Count - } - return json.Marshal(objectMap) -} - -// IssueCollectionIterator provides access to a complete listing of IssueContract values. -type IssueCollectionIterator struct { - i int - page IssueCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IssueCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IssueCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IssueCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IssueCollectionIterator) Response() IssueCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IssueCollectionIterator) Value() IssueContract { - if !iter.page.NotDone() { - return IssueContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IssueCollectionIterator type. -func NewIssueCollectionIterator(page IssueCollectionPage) IssueCollectionIterator { - return IssueCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ic IssueCollection) IsEmpty() bool { - return ic.Value == nil || len(*ic.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ic IssueCollection) hasNextLink() bool { - return ic.NextLink != nil && len(*ic.NextLink) != 0 -} - -// issueCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ic IssueCollection) issueCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !ic.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ic.NextLink))) -} - -// IssueCollectionPage contains a page of IssueContract values. -type IssueCollectionPage struct { - fn func(context.Context, IssueCollection) (IssueCollection, error) - ic IssueCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IssueCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ic) - if err != nil { - return err - } - page.ic = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IssueCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IssueCollectionPage) NotDone() bool { - return !page.ic.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IssueCollectionPage) Response() IssueCollection { - return page.ic -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IssueCollectionPage) Values() []IssueContract { - if page.ic.IsEmpty() { - return nil - } - return *page.ic.Value -} - -// Creates a new instance of the IssueCollectionPage type. -func NewIssueCollectionPage(cur IssueCollection, getNextPage func(context.Context, IssueCollection) (IssueCollection, error)) IssueCollectionPage { - return IssueCollectionPage{ - fn: getNextPage, - ic: cur, - } -} - -// IssueCommentCollection paged Issue Comment list representation. -type IssueCommentCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Issue Comment values. - Value *[]IssueCommentContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueCommentCollection. -func (icc IssueCommentCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if icc.Count != nil { - objectMap["count"] = icc.Count - } - return json.Marshal(objectMap) -} - -// IssueCommentCollectionIterator provides access to a complete listing of IssueCommentContract values. -type IssueCommentCollectionIterator struct { - i int - page IssueCommentCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IssueCommentCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueCommentCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IssueCommentCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IssueCommentCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IssueCommentCollectionIterator) Response() IssueCommentCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IssueCommentCollectionIterator) Value() IssueCommentContract { - if !iter.page.NotDone() { - return IssueCommentContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IssueCommentCollectionIterator type. -func NewIssueCommentCollectionIterator(page IssueCommentCollectionPage) IssueCommentCollectionIterator { - return IssueCommentCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (icc IssueCommentCollection) IsEmpty() bool { - return icc.Value == nil || len(*icc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (icc IssueCommentCollection) hasNextLink() bool { - return icc.NextLink != nil && len(*icc.NextLink) != 0 -} - -// issueCommentCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (icc IssueCommentCollection) issueCommentCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !icc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(icc.NextLink))) -} - -// IssueCommentCollectionPage contains a page of IssueCommentContract values. -type IssueCommentCollectionPage struct { - fn func(context.Context, IssueCommentCollection) (IssueCommentCollection, error) - icc IssueCommentCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IssueCommentCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueCommentCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.icc) - if err != nil { - return err - } - page.icc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IssueCommentCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IssueCommentCollectionPage) NotDone() bool { - return !page.icc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IssueCommentCollectionPage) Response() IssueCommentCollection { - return page.icc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IssueCommentCollectionPage) Values() []IssueCommentContract { - if page.icc.IsEmpty() { - return nil - } - return *page.icc.Value -} - -// Creates a new instance of the IssueCommentCollectionPage type. -func NewIssueCommentCollectionPage(cur IssueCommentCollection, getNextPage func(context.Context, IssueCommentCollection) (IssueCommentCollection, error)) IssueCommentCollectionPage { - return IssueCommentCollectionPage{ - fn: getNextPage, - icc: cur, - } -} - -// IssueCommentContract issue Comment Contract details. -type IssueCommentContract struct { - autorest.Response `json:"-"` - // IssueCommentContractProperties - Properties of the Issue Comment. - *IssueCommentContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueCommentContract. -func (icc IssueCommentContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if icc.IssueCommentContractProperties != nil { - objectMap["properties"] = icc.IssueCommentContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IssueCommentContract struct. -func (icc *IssueCommentContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var issueCommentContractProperties IssueCommentContractProperties - err = json.Unmarshal(*v, &issueCommentContractProperties) - if err != nil { - return err - } - icc.IssueCommentContractProperties = &issueCommentContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - icc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - icc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - icc.Type = &typeVar - } - } - } - - return nil -} - -// IssueCommentContractProperties issue Comment contract Properties. -type IssueCommentContractProperties struct { - // Text - Comment text. - Text *string `json:"text,omitempty"` - // CreatedDate - Date and time when the comment was created. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // UserID - A resource identifier for the user who left the comment. - UserID *string `json:"userId,omitempty"` -} - -// IssueContract issue Contract details. -type IssueContract struct { - autorest.Response `json:"-"` - // IssueContractProperties - Properties of the Issue. - *IssueContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueContract. -func (ic IssueContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ic.IssueContractProperties != nil { - objectMap["properties"] = ic.IssueContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IssueContract struct. -func (ic *IssueContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var issueContractProperties IssueContractProperties - err = json.Unmarshal(*v, &issueContractProperties) - if err != nil { - return err - } - ic.IssueContractProperties = &issueContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ic.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ic.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ic.Type = &typeVar - } - } - } - - return nil -} - -// IssueContractBaseProperties issue contract Base Properties. -type IssueContractBaseProperties struct { - // CreatedDate - Date and time when the issue was created. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // State - Status of the issue. Possible values include: 'StateProposed', 'StateOpen', 'StateRemoved', 'StateResolved', 'StateClosed' - State State `json:"state,omitempty"` - // APIID - A resource identifier for the API the issue was created for. - APIID *string `json:"apiId,omitempty"` -} - -// IssueContractProperties issue contract Properties. -type IssueContractProperties struct { - // Title - The issue title. - Title *string `json:"title,omitempty"` - // Description - Text describing the issue. - Description *string `json:"description,omitempty"` - // UserID - A resource identifier for the user created the issue. - UserID *string `json:"userId,omitempty"` - // CreatedDate - Date and time when the issue was created. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // State - Status of the issue. Possible values include: 'StateProposed', 'StateOpen', 'StateRemoved', 'StateResolved', 'StateClosed' - State State `json:"state,omitempty"` - // APIID - A resource identifier for the API the issue was created for. - APIID *string `json:"apiId,omitempty"` -} - -// IssueUpdateContract issue update Parameters. -type IssueUpdateContract struct { - // IssueUpdateContractProperties - Issue entity Update contract properties. - *IssueUpdateContractProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueUpdateContract. -func (iuc IssueUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iuc.IssueUpdateContractProperties != nil { - objectMap["properties"] = iuc.IssueUpdateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IssueUpdateContract struct. -func (iuc *IssueUpdateContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var issueUpdateContractProperties IssueUpdateContractProperties - err = json.Unmarshal(*v, &issueUpdateContractProperties) - if err != nil { - return err - } - iuc.IssueUpdateContractProperties = &issueUpdateContractProperties - } - } - } - - return nil -} - -// IssueUpdateContractProperties issue contract Update Properties. -type IssueUpdateContractProperties struct { - // Title - The issue title. - Title *string `json:"title,omitempty"` - // Description - Text describing the issue. - Description *string `json:"description,omitempty"` - // UserID - A resource identifier for the user created the issue. - UserID *string `json:"userId,omitempty"` - // CreatedDate - Date and time when the issue was created. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // State - Status of the issue. Possible values include: 'StateProposed', 'StateOpen', 'StateRemoved', 'StateResolved', 'StateClosed' - State State `json:"state,omitempty"` - // APIID - A resource identifier for the API the issue was created for. - APIID *string `json:"apiId,omitempty"` -} - -// KeyVaultContractCreateProperties create keyVault contract details. -type KeyVaultContractCreateProperties struct { - // SecretIdentifier - Key vault secret identifier for fetching secret. Providing a versioned secret will prevent auto-refresh. This requires API Management service to be configured with aka.ms/apimmsi - SecretIdentifier *string `json:"secretIdentifier,omitempty"` - // IdentityClientID - SystemAssignedIdentity or UserAssignedIdentity Client Id which will be used to access key vault secret. - IdentityClientID *string `json:"identityClientId,omitempty"` -} - -// KeyVaultContractProperties keyVault contract details. -type KeyVaultContractProperties struct { - // LastStatus - Last time sync and refresh status of secret from key vault. - LastStatus *KeyVaultLastAccessStatusContractProperties `json:"lastStatus,omitempty"` - // SecretIdentifier - Key vault secret identifier for fetching secret. Providing a versioned secret will prevent auto-refresh. This requires API Management service to be configured with aka.ms/apimmsi - SecretIdentifier *string `json:"secretIdentifier,omitempty"` - // IdentityClientID - SystemAssignedIdentity or UserAssignedIdentity Client Id which will be used to access key vault secret. - IdentityClientID *string `json:"identityClientId,omitempty"` -} - -// KeyVaultLastAccessStatusContractProperties issue contract Update Properties. -type KeyVaultLastAccessStatusContractProperties struct { - // Code - Last status code for sync and refresh of secret from key vault. - Code *string `json:"code,omitempty"` - // Message - Details of the error else empty. - Message *string `json:"message,omitempty"` - // TimeStampUtc - Last time secret was accessed. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - TimeStampUtc *date.Time `json:"timeStampUtc,omitempty"` -} - -// ListNetworkStatusContractByLocation ... -type ListNetworkStatusContractByLocation struct { - autorest.Response `json:"-"` - Value *[]NetworkStatusContractByLocation `json:"value,omitempty"` -} - -// LoggerCollection paged Logger list representation. -type LoggerCollection struct { - autorest.Response `json:"-"` - // Value - Logger values. - Value *[]LoggerContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// LoggerCollectionIterator provides access to a complete listing of LoggerContract values. -type LoggerCollectionIterator struct { - i int - page LoggerCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *LoggerCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *LoggerCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LoggerCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter LoggerCollectionIterator) Response() LoggerCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter LoggerCollectionIterator) Value() LoggerContract { - if !iter.page.NotDone() { - return LoggerContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LoggerCollectionIterator type. -func NewLoggerCollectionIterator(page LoggerCollectionPage) LoggerCollectionIterator { - return LoggerCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lc LoggerCollection) IsEmpty() bool { - return lc.Value == nil || len(*lc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lc LoggerCollection) hasNextLink() bool { - return lc.NextLink != nil && len(*lc.NextLink) != 0 -} - -// loggerCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lc LoggerCollection) loggerCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !lc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lc.NextLink))) -} - -// LoggerCollectionPage contains a page of LoggerContract values. -type LoggerCollectionPage struct { - fn func(context.Context, LoggerCollection) (LoggerCollection, error) - lc LoggerCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *LoggerCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lc) - if err != nil { - return err - } - page.lc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *LoggerCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LoggerCollectionPage) NotDone() bool { - return !page.lc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LoggerCollectionPage) Response() LoggerCollection { - return page.lc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LoggerCollectionPage) Values() []LoggerContract { - if page.lc.IsEmpty() { - return nil - } - return *page.lc.Value -} - -// Creates a new instance of the LoggerCollectionPage type. -func NewLoggerCollectionPage(cur LoggerCollection, getNextPage func(context.Context, LoggerCollection) (LoggerCollection, error)) LoggerCollectionPage { - return LoggerCollectionPage{ - fn: getNextPage, - lc: cur, - } -} - -// LoggerContract logger details. -type LoggerContract struct { - autorest.Response `json:"-"` - // LoggerContractProperties - Logger entity contract properties. - *LoggerContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoggerContract. -func (lc LoggerContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lc.LoggerContractProperties != nil { - objectMap["properties"] = lc.LoggerContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LoggerContract struct. -func (lc *LoggerContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var loggerContractProperties LoggerContractProperties - err = json.Unmarshal(*v, &loggerContractProperties) - if err != nil { - return err - } - lc.LoggerContractProperties = &loggerContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lc.Type = &typeVar - } - } - } - - return nil -} - -// LoggerContractProperties the Logger entity in API Management represents an event sink that you can use -// to log API Management events. Currently the Logger entity supports logging API Management events to -// Azure Event Hubs. -type LoggerContractProperties struct { - // LoggerType - Logger type. Possible values include: 'LoggerTypeAzureEventHub', 'LoggerTypeApplicationInsights', 'LoggerTypeAzureMonitor' - LoggerType LoggerType `json:"loggerType,omitempty"` - // Description - Logger description. - Description *string `json:"description,omitempty"` - // Credentials - The name and SendRule connection string of the event hub for azureEventHub logger. - // Instrumentation key for applicationInsights logger. - Credentials map[string]*string `json:"credentials"` - // IsBuffered - Whether records are buffered in the logger before publishing. Default is assumed to be true. - IsBuffered *bool `json:"isBuffered,omitempty"` - // ResourceID - Azure Resource Id of a log target (either Azure Event Hub resource or Azure Application Insights resource). - ResourceID *string `json:"resourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoggerContractProperties. -func (lcp LoggerContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lcp.LoggerType != "" { - objectMap["loggerType"] = lcp.LoggerType - } - if lcp.Description != nil { - objectMap["description"] = lcp.Description - } - if lcp.Credentials != nil { - objectMap["credentials"] = lcp.Credentials - } - if lcp.IsBuffered != nil { - objectMap["isBuffered"] = lcp.IsBuffered - } - if lcp.ResourceID != nil { - objectMap["resourceId"] = lcp.ResourceID - } - return json.Marshal(objectMap) -} - -// LoggerUpdateContract logger update contract. -type LoggerUpdateContract struct { - // LoggerUpdateParameters - Logger entity update contract properties. - *LoggerUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoggerUpdateContract. -func (luc LoggerUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if luc.LoggerUpdateParameters != nil { - objectMap["properties"] = luc.LoggerUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LoggerUpdateContract struct. -func (luc *LoggerUpdateContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var loggerUpdateParameters LoggerUpdateParameters - err = json.Unmarshal(*v, &loggerUpdateParameters) - if err != nil { - return err - } - luc.LoggerUpdateParameters = &loggerUpdateParameters - } - } - } - - return nil -} - -// LoggerUpdateParameters parameters supplied to the Update Logger operation. -type LoggerUpdateParameters struct { - // LoggerType - Logger type. Possible values include: 'LoggerTypeAzureEventHub', 'LoggerTypeApplicationInsights', 'LoggerTypeAzureMonitor' - LoggerType LoggerType `json:"loggerType,omitempty"` - // Description - Logger description. - Description *string `json:"description,omitempty"` - // Credentials - Logger credentials. - Credentials map[string]*string `json:"credentials"` - // IsBuffered - Whether records are buffered in the logger before publishing. Default is assumed to be true. - IsBuffered *bool `json:"isBuffered,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoggerUpdateParameters. -func (lup LoggerUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lup.LoggerType != "" { - objectMap["loggerType"] = lup.LoggerType - } - if lup.Description != nil { - objectMap["description"] = lup.Description - } - if lup.Credentials != nil { - objectMap["credentials"] = lup.Credentials - } - if lup.IsBuffered != nil { - objectMap["isBuffered"] = lup.IsBuffered - } - return json.Marshal(objectMap) -} - -// NamedValueCollection paged NamedValue list representation. -type NamedValueCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]NamedValueContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// NamedValueCollectionIterator provides access to a complete listing of NamedValueContract values. -type NamedValueCollectionIterator struct { - i int - page NamedValueCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *NamedValueCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *NamedValueCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter NamedValueCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter NamedValueCollectionIterator) Response() NamedValueCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter NamedValueCollectionIterator) Value() NamedValueContract { - if !iter.page.NotDone() { - return NamedValueContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the NamedValueCollectionIterator type. -func NewNamedValueCollectionIterator(page NamedValueCollectionPage) NamedValueCollectionIterator { - return NamedValueCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (nvc NamedValueCollection) IsEmpty() bool { - return nvc.Value == nil || len(*nvc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (nvc NamedValueCollection) hasNextLink() bool { - return nvc.NextLink != nil && len(*nvc.NextLink) != 0 -} - -// namedValueCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (nvc NamedValueCollection) namedValueCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !nvc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(nvc.NextLink))) -} - -// NamedValueCollectionPage contains a page of NamedValueContract values. -type NamedValueCollectionPage struct { - fn func(context.Context, NamedValueCollection) (NamedValueCollection, error) - nvc NamedValueCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *NamedValueCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.nvc) - if err != nil { - return err - } - page.nvc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *NamedValueCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page NamedValueCollectionPage) NotDone() bool { - return !page.nvc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page NamedValueCollectionPage) Response() NamedValueCollection { - return page.nvc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page NamedValueCollectionPage) Values() []NamedValueContract { - if page.nvc.IsEmpty() { - return nil - } - return *page.nvc.Value -} - -// Creates a new instance of the NamedValueCollectionPage type. -func NewNamedValueCollectionPage(cur NamedValueCollection, getNextPage func(context.Context, NamedValueCollection) (NamedValueCollection, error)) NamedValueCollectionPage { - return NamedValueCollectionPage{ - fn: getNextPage, - nvc: cur, - } -} - -// NamedValueContract namedValue details. -type NamedValueContract struct { - autorest.Response `json:"-"` - // NamedValueContractProperties - NamedValue entity contract properties. - *NamedValueContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NamedValueContract. -func (nvc NamedValueContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nvc.NamedValueContractProperties != nil { - objectMap["properties"] = nvc.NamedValueContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NamedValueContract struct. -func (nvc *NamedValueContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var namedValueContractProperties NamedValueContractProperties - err = json.Unmarshal(*v, &namedValueContractProperties) - if err != nil { - return err - } - nvc.NamedValueContractProperties = &namedValueContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nvc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nvc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nvc.Type = &typeVar - } - } - } - - return nil -} - -// NamedValueContractProperties namedValue Contract properties. -type NamedValueContractProperties struct { - // DisplayName - Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - DisplayName *string `json:"displayName,omitempty"` - // Value - Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - Value *string `json:"value,omitempty"` - // KeyVault - KeyVault location details of the namedValue. - KeyVault *KeyVaultContractProperties `json:"keyVault,omitempty"` - // Tags - Optional tags that when provided can be used to filter the NamedValue list. - Tags *[]string `json:"tags,omitempty"` - // Secret - Determines whether the value is a secret and should be encrypted or not. Default value is false. - Secret *bool `json:"secret,omitempty"` -} - -// NamedValueCreateContract namedValue details. -type NamedValueCreateContract struct { - // NamedValueCreateContractProperties - NamedValue entity contract properties for PUT operation. - *NamedValueCreateContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NamedValueCreateContract. -func (nvcc NamedValueCreateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nvcc.NamedValueCreateContractProperties != nil { - objectMap["properties"] = nvcc.NamedValueCreateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NamedValueCreateContract struct. -func (nvcc *NamedValueCreateContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var namedValueCreateContractProperties NamedValueCreateContractProperties - err = json.Unmarshal(*v, &namedValueCreateContractProperties) - if err != nil { - return err - } - nvcc.NamedValueCreateContractProperties = &namedValueCreateContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nvcc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nvcc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nvcc.Type = &typeVar - } - } - } - - return nil -} - -// NamedValueCreateContractProperties namedValue Contract properties. -type NamedValueCreateContractProperties struct { - // DisplayName - Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - DisplayName *string `json:"displayName,omitempty"` - // Value - Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - Value *string `json:"value,omitempty"` - // KeyVault - KeyVault location details of the namedValue. - KeyVault *KeyVaultContractCreateProperties `json:"keyVault,omitempty"` - // Tags - Optional tags that when provided can be used to filter the NamedValue list. - Tags *[]string `json:"tags,omitempty"` - // Secret - Determines whether the value is a secret and should be encrypted or not. Default value is false. - Secret *bool `json:"secret,omitempty"` -} - -// NamedValueCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NamedValueCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NamedValueClient) (NamedValueContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NamedValueCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for NamedValueCreateOrUpdateFuture.Result. -func (future *NamedValueCreateOrUpdateFuture) result(client NamedValueClient) (nvc NamedValueContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - nvc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.NamedValueCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if nvc.Response.Response, err = future.GetResult(sender); err == nil && nvc.Response.Response.StatusCode != http.StatusNoContent { - nvc, err = client.CreateOrUpdateResponder(nvc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueCreateOrUpdateFuture", "Result", nvc.Response.Response, "Failure responding to request") - } - } - return -} - -// NamedValueEntityBaseParameters namedValue Entity Base Parameters set. -type NamedValueEntityBaseParameters struct { - // Tags - Optional tags that when provided can be used to filter the NamedValue list. - Tags *[]string `json:"tags,omitempty"` - // Secret - Determines whether the value is a secret and should be encrypted or not. Default value is false. - Secret *bool `json:"secret,omitempty"` -} - -// NamedValueRefreshSecretFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NamedValueRefreshSecretFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NamedValueClient) (NamedValueContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NamedValueRefreshSecretFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for NamedValueRefreshSecretFuture.Result. -func (future *NamedValueRefreshSecretFuture) result(client NamedValueClient) (nvc NamedValueContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueRefreshSecretFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - nvc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.NamedValueRefreshSecretFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if nvc.Response.Response, err = future.GetResult(sender); err == nil && nvc.Response.Response.StatusCode != http.StatusNoContent { - nvc, err = client.RefreshSecretResponder(nvc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueRefreshSecretFuture", "Result", nvc.Response.Response, "Failure responding to request") - } - } - return -} - -// NamedValueSecretContract client or app secret used in IdentityProviders, Aad, OpenID or OAuth. -type NamedValueSecretContract struct { - autorest.Response `json:"-"` - // Value - This is secret value of the NamedValue entity. - Value *string `json:"value,omitempty"` -} - -// NamedValueUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NamedValueUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NamedValueClient) (NamedValueContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NamedValueUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for NamedValueUpdateFuture.Result. -func (future *NamedValueUpdateFuture) result(client NamedValueClient) (nvc NamedValueContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - nvc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.NamedValueUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if nvc.Response.Response, err = future.GetResult(sender); err == nil && nvc.Response.Response.StatusCode != http.StatusNoContent { - nvc, err = client.UpdateResponder(nvc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueUpdateFuture", "Result", nvc.Response.Response, "Failure responding to request") - } - } - return -} - -// NamedValueUpdateParameterProperties namedValue Contract properties. -type NamedValueUpdateParameterProperties struct { - // DisplayName - Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - DisplayName *string `json:"displayName,omitempty"` - // Value - Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. - Value *string `json:"value,omitempty"` - // KeyVault - KeyVault location details of the namedValue. - KeyVault *KeyVaultContractCreateProperties `json:"keyVault,omitempty"` - // Tags - Optional tags that when provided can be used to filter the NamedValue list. - Tags *[]string `json:"tags,omitempty"` - // Secret - Determines whether the value is a secret and should be encrypted or not. Default value is false. - Secret *bool `json:"secret,omitempty"` -} - -// NamedValueUpdateParameters namedValue update Parameters. -type NamedValueUpdateParameters struct { - // NamedValueUpdateParameterProperties - NamedValue entity Update contract properties. - *NamedValueUpdateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for NamedValueUpdateParameters. -func (nvup NamedValueUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nvup.NamedValueUpdateParameterProperties != nil { - objectMap["properties"] = nvup.NamedValueUpdateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NamedValueUpdateParameters struct. -func (nvup *NamedValueUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var namedValueUpdateParameterProperties NamedValueUpdateParameterProperties - err = json.Unmarshal(*v, &namedValueUpdateParameterProperties) - if err != nil { - return err - } - nvup.NamedValueUpdateParameterProperties = &namedValueUpdateParameterProperties - } - } - } - - return nil -} - -// NetworkStatusContract network Status details. -type NetworkStatusContract struct { - autorest.Response `json:"-"` - // DNSServers - Gets the list of DNS servers IPV4 addresses. - DNSServers *[]string `json:"dnsServers,omitempty"` - // ConnectivityStatus - Gets the list of Connectivity Status to the Resources on which the service depends upon. - ConnectivityStatus *[]ConnectivityStatusContract `json:"connectivityStatus,omitempty"` -} - -// NetworkStatusContractByLocation network Status in the Location -type NetworkStatusContractByLocation struct { - // Location - Location of service - Location *string `json:"location,omitempty"` - // NetworkStatus - Network status in Location - NetworkStatus *NetworkStatusContract `json:"networkStatus,omitempty"` -} - -// NotificationCollection paged Notification list representation. -type NotificationCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]NotificationContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// NotificationCollectionIterator provides access to a complete listing of NotificationContract values. -type NotificationCollectionIterator struct { - i int - page NotificationCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *NotificationCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *NotificationCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter NotificationCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter NotificationCollectionIterator) Response() NotificationCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter NotificationCollectionIterator) Value() NotificationContract { - if !iter.page.NotDone() { - return NotificationContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the NotificationCollectionIterator type. -func NewNotificationCollectionIterator(page NotificationCollectionPage) NotificationCollectionIterator { - return NotificationCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (nc NotificationCollection) IsEmpty() bool { - return nc.Value == nil || len(*nc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (nc NotificationCollection) hasNextLink() bool { - return nc.NextLink != nil && len(*nc.NextLink) != 0 -} - -// notificationCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (nc NotificationCollection) notificationCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !nc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(nc.NextLink))) -} - -// NotificationCollectionPage contains a page of NotificationContract values. -type NotificationCollectionPage struct { - fn func(context.Context, NotificationCollection) (NotificationCollection, error) - nc NotificationCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *NotificationCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.nc) - if err != nil { - return err - } - page.nc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *NotificationCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page NotificationCollectionPage) NotDone() bool { - return !page.nc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page NotificationCollectionPage) Response() NotificationCollection { - return page.nc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page NotificationCollectionPage) Values() []NotificationContract { - if page.nc.IsEmpty() { - return nil - } - return *page.nc.Value -} - -// Creates a new instance of the NotificationCollectionPage type. -func NewNotificationCollectionPage(cur NotificationCollection, getNextPage func(context.Context, NotificationCollection) (NotificationCollection, error)) NotificationCollectionPage { - return NotificationCollectionPage{ - fn: getNextPage, - nc: cur, - } -} - -// NotificationContract notification details. -type NotificationContract struct { - autorest.Response `json:"-"` - // NotificationContractProperties - Notification entity contract properties. - *NotificationContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotificationContract. -func (nc NotificationContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nc.NotificationContractProperties != nil { - objectMap["properties"] = nc.NotificationContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NotificationContract struct. -func (nc *NotificationContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var notificationContractProperties NotificationContractProperties - err = json.Unmarshal(*v, ¬ificationContractProperties) - if err != nil { - return err - } - nc.NotificationContractProperties = ¬ificationContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nc.Type = &typeVar - } - } - } - - return nil -} - -// NotificationContractProperties notification Contract properties. -type NotificationContractProperties struct { - // Title - Title of the Notification. - Title *string `json:"title,omitempty"` - // Description - Description of the Notification. - Description *string `json:"description,omitempty"` - // Recipients - Recipient Parameter values. - Recipients *RecipientsContractProperties `json:"recipients,omitempty"` -} - -// OAuth2AuthenticationSettingsContract API OAuth2 Authentication settings details. -type OAuth2AuthenticationSettingsContract struct { - // AuthorizationServerID - OAuth authorization server identifier. - AuthorizationServerID *string `json:"authorizationServerId,omitempty"` - // Scope - operations scope. - Scope *string `json:"scope,omitempty"` -} - -// OpenIDAuthenticationSettingsContract API OAuth2 Authentication settings details. -type OpenIDAuthenticationSettingsContract struct { - // OpenidProviderID - OAuth authorization server identifier. - OpenidProviderID *string `json:"openidProviderId,omitempty"` - // BearerTokenSendingMethods - How to send token to the server. - BearerTokenSendingMethods *[]BearerTokenSendingMethods `json:"bearerTokenSendingMethods,omitempty"` -} - -// OpenIDConnectProviderCollection paged OpenIdProviders list representation. -type OpenIDConnectProviderCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]OpenidConnectProviderContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// OpenIDConnectProviderCollectionIterator provides access to a complete listing of -// OpenidConnectProviderContract values. -type OpenIDConnectProviderCollectionIterator struct { - i int - page OpenIDConnectProviderCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OpenIDConnectProviderCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OpenIDConnectProviderCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OpenIDConnectProviderCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OpenIDConnectProviderCollectionIterator) Response() OpenIDConnectProviderCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OpenIDConnectProviderCollectionIterator) Value() OpenidConnectProviderContract { - if !iter.page.NotDone() { - return OpenidConnectProviderContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OpenIDConnectProviderCollectionIterator type. -func NewOpenIDConnectProviderCollectionIterator(page OpenIDConnectProviderCollectionPage) OpenIDConnectProviderCollectionIterator { - return OpenIDConnectProviderCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (oicpc OpenIDConnectProviderCollection) IsEmpty() bool { - return oicpc.Value == nil || len(*oicpc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (oicpc OpenIDConnectProviderCollection) hasNextLink() bool { - return oicpc.NextLink != nil && len(*oicpc.NextLink) != 0 -} - -// openIDConnectProviderCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (oicpc OpenIDConnectProviderCollection) openIDConnectProviderCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !oicpc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(oicpc.NextLink))) -} - -// OpenIDConnectProviderCollectionPage contains a page of OpenidConnectProviderContract values. -type OpenIDConnectProviderCollectionPage struct { - fn func(context.Context, OpenIDConnectProviderCollection) (OpenIDConnectProviderCollection, error) - oicpc OpenIDConnectProviderCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OpenIDConnectProviderCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.oicpc) - if err != nil { - return err - } - page.oicpc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OpenIDConnectProviderCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OpenIDConnectProviderCollectionPage) NotDone() bool { - return !page.oicpc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OpenIDConnectProviderCollectionPage) Response() OpenIDConnectProviderCollection { - return page.oicpc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OpenIDConnectProviderCollectionPage) Values() []OpenidConnectProviderContract { - if page.oicpc.IsEmpty() { - return nil - } - return *page.oicpc.Value -} - -// Creates a new instance of the OpenIDConnectProviderCollectionPage type. -func NewOpenIDConnectProviderCollectionPage(cur OpenIDConnectProviderCollection, getNextPage func(context.Context, OpenIDConnectProviderCollection) (OpenIDConnectProviderCollection, error)) OpenIDConnectProviderCollectionPage { - return OpenIDConnectProviderCollectionPage{ - fn: getNextPage, - oicpc: cur, - } -} - -// OpenidConnectProviderContract openId Connect Provider details. -type OpenidConnectProviderContract struct { - autorest.Response `json:"-"` - // OpenidConnectProviderContractProperties - OpenId Connect Provider contract properties. - *OpenidConnectProviderContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for OpenidConnectProviderContract. -func (ocpc OpenidConnectProviderContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ocpc.OpenidConnectProviderContractProperties != nil { - objectMap["properties"] = ocpc.OpenidConnectProviderContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OpenidConnectProviderContract struct. -func (ocpc *OpenidConnectProviderContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var openidConnectProviderContractProperties OpenidConnectProviderContractProperties - err = json.Unmarshal(*v, &openidConnectProviderContractProperties) - if err != nil { - return err - } - ocpc.OpenidConnectProviderContractProperties = &openidConnectProviderContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ocpc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ocpc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ocpc.Type = &typeVar - } - } - } - - return nil -} - -// OpenidConnectProviderContractProperties openID Connect Providers Contract. -type OpenidConnectProviderContractProperties struct { - // DisplayName - User-friendly OpenID Connect Provider name. - DisplayName *string `json:"displayName,omitempty"` - // Description - User-friendly description of OpenID Connect Provider. - Description *string `json:"description,omitempty"` - // MetadataEndpoint - Metadata endpoint URI. - MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` - // ClientID - Client ID of developer console which is the client application. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client Secret of developer console which is the client application. - ClientSecret *string `json:"clientSecret,omitempty"` -} - -// OpenidConnectProviderUpdateContract parameters supplied to the Update OpenID Connect Provider operation. -type OpenidConnectProviderUpdateContract struct { - // OpenidConnectProviderUpdateContractProperties - OpenId Connect Provider Update contract properties. - *OpenidConnectProviderUpdateContractProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for OpenidConnectProviderUpdateContract. -func (ocpuc OpenidConnectProviderUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ocpuc.OpenidConnectProviderUpdateContractProperties != nil { - objectMap["properties"] = ocpuc.OpenidConnectProviderUpdateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OpenidConnectProviderUpdateContract struct. -func (ocpuc *OpenidConnectProviderUpdateContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var openidConnectProviderUpdateContractProperties OpenidConnectProviderUpdateContractProperties - err = json.Unmarshal(*v, &openidConnectProviderUpdateContractProperties) - if err != nil { - return err - } - ocpuc.OpenidConnectProviderUpdateContractProperties = &openidConnectProviderUpdateContractProperties - } - } - } - - return nil -} - -// OpenidConnectProviderUpdateContractProperties parameters supplied to the Update OpenID Connect Provider -// operation. -type OpenidConnectProviderUpdateContractProperties struct { - // DisplayName - User-friendly OpenID Connect Provider name. - DisplayName *string `json:"displayName,omitempty"` - // Description - User-friendly description of OpenID Connect Provider. - Description *string `json:"description,omitempty"` - // MetadataEndpoint - Metadata endpoint URI. - MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` - // ClientID - Client ID of developer console which is the client application. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client Secret of developer console which is the client application. - ClientSecret *string `json:"clientSecret,omitempty"` -} - -// Operation REST API operation -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - The object that describes the operation. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - The operation origin. - Origin *string `json:"origin,omitempty"` - // Properties - The operation properties. - Properties interface{} `json:"properties,omitempty"` -} - -// OperationCollection paged Operation list representation. -type OperationCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]OperationContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationCollection. -func (oc OperationCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oc.Count != nil { - objectMap["count"] = oc.Count - } - return json.Marshal(objectMap) -} - -// OperationCollectionIterator provides access to a complete listing of OperationContract values. -type OperationCollectionIterator struct { - i int - page OperationCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationCollectionIterator) Response() OperationCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationCollectionIterator) Value() OperationContract { - if !iter.page.NotDone() { - return OperationContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationCollectionIterator type. -func NewOperationCollectionIterator(page OperationCollectionPage) OperationCollectionIterator { - return OperationCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (oc OperationCollection) IsEmpty() bool { - return oc.Value == nil || len(*oc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (oc OperationCollection) hasNextLink() bool { - return oc.NextLink != nil && len(*oc.NextLink) != 0 -} - -// operationCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (oc OperationCollection) operationCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !oc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(oc.NextLink))) -} - -// OperationCollectionPage contains a page of OperationContract values. -type OperationCollectionPage struct { - fn func(context.Context, OperationCollection) (OperationCollection, error) - oc OperationCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.oc) - if err != nil { - return err - } - page.oc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationCollectionPage) NotDone() bool { - return !page.oc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationCollectionPage) Response() OperationCollection { - return page.oc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationCollectionPage) Values() []OperationContract { - if page.oc.IsEmpty() { - return nil - } - return *page.oc.Value -} - -// Creates a new instance of the OperationCollectionPage type. -func NewOperationCollectionPage(cur OperationCollection, getNextPage func(context.Context, OperationCollection) (OperationCollection, error)) OperationCollectionPage { - return OperationCollectionPage{ - fn: getNextPage, - oc: cur, - } -} - -// OperationContract API Operation details. -type OperationContract struct { - autorest.Response `json:"-"` - // OperationContractProperties - Properties of the Operation Contract. - *OperationContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationContract. -func (oc OperationContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oc.OperationContractProperties != nil { - objectMap["properties"] = oc.OperationContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationContract struct. -func (oc *OperationContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var operationContractProperties OperationContractProperties - err = json.Unmarshal(*v, &operationContractProperties) - if err != nil { - return err - } - oc.OperationContractProperties = &operationContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - oc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - oc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - oc.Type = &typeVar - } - } - } - - return nil -} - -// OperationContractProperties operation Contract Properties -type OperationContractProperties struct { - // DisplayName - Operation Name. - DisplayName *string `json:"displayName,omitempty"` - // Method - A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. - Method *string `json:"method,omitempty"` - // URLTemplate - Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date} - URLTemplate *string `json:"urlTemplate,omitempty"` - // TemplateParameters - Collection of URL template parameters. - TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` - // Description - Description of the operation. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Request - An entity containing request details. - Request *RequestContract `json:"request,omitempty"` - // Responses - Array of Operation responses. - Responses *[]ResponseContract `json:"responses,omitempty"` - // Policies - Operation Policies - Policies *string `json:"policies,omitempty"` -} - -// OperationDisplay the object that describes the operation. -type OperationDisplay struct { - // Provider - Friendly name of the resource provider - Provider *string `json:"provider,omitempty"` - // Operation - Operation type: read, write, delete, listKeys/action, etc. - Operation *string `json:"operation,omitempty"` - // Resource - Resource type on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Description - Friendly name of the operation - Description *string `json:"description,omitempty"` -} - -// OperationEntityBaseContract API Operation Entity Base Contract details. -type OperationEntityBaseContract struct { - // TemplateParameters - Collection of URL template parameters. - TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` - // Description - Description of the operation. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Request - An entity containing request details. - Request *RequestContract `json:"request,omitempty"` - // Responses - Array of Operation responses. - Responses *[]ResponseContract `json:"responses,omitempty"` - // Policies - Operation Policies - Policies *string `json:"policies,omitempty"` -} - -// OperationListResult result of the request to list REST API operations. It contains a list of operations -// and a URL nextLink to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the resource provider. - Value *[]Operation `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// OperationResultContract long Running Git Operation Results. -type OperationResultContract struct { - autorest.Response `json:"-"` - // OperationResultContractProperties - Properties of the Operation Contract. - *OperationResultContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationResultContract. -func (orc OperationResultContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if orc.OperationResultContractProperties != nil { - objectMap["properties"] = orc.OperationResultContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationResultContract struct. -func (orc *OperationResultContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var operationResultContractProperties OperationResultContractProperties - err = json.Unmarshal(*v, &operationResultContractProperties) - if err != nil { - return err - } - orc.OperationResultContractProperties = &operationResultContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - orc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - orc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - orc.Type = &typeVar - } - } - } - - return nil -} - -// OperationResultContractProperties operation Result. -type OperationResultContractProperties struct { - // ID - Operation result identifier. - ID *string `json:"id,omitempty"` - // Status - Status of an async operation. Possible values include: 'AsyncOperationStatusStarted', 'AsyncOperationStatusInProgress', 'AsyncOperationStatusSucceeded', 'AsyncOperationStatusFailed' - Status AsyncOperationStatus `json:"status,omitempty"` - // Started - Start time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Started *date.Time `json:"started,omitempty"` - // Updated - Last update time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Updated *date.Time `json:"updated,omitempty"` - // ResultInfo - Optional result info. - ResultInfo *string `json:"resultInfo,omitempty"` - // Error - Error Body Contract - Error *ErrorResponseBody `json:"error,omitempty"` - // ActionLog - READ-ONLY; This property if only provided as part of the TenantConfiguration_Validate operation. It contains the log the entities which will be updated/created/deleted as part of the TenantConfiguration_Deploy operation. - ActionLog *[]OperationResultLogItemContract `json:"actionLog,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationResultContractProperties. -func (orcp OperationResultContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if orcp.ID != nil { - objectMap["id"] = orcp.ID - } - if orcp.Status != "" { - objectMap["status"] = orcp.Status - } - if orcp.Started != nil { - objectMap["started"] = orcp.Started - } - if orcp.Updated != nil { - objectMap["updated"] = orcp.Updated - } - if orcp.ResultInfo != nil { - objectMap["resultInfo"] = orcp.ResultInfo - } - if orcp.Error != nil { - objectMap["error"] = orcp.Error - } - return json.Marshal(objectMap) -} - -// OperationResultLogItemContract log of the entity being created, updated or deleted. -type OperationResultLogItemContract struct { - // ObjectType - The type of entity contract. - ObjectType *string `json:"objectType,omitempty"` - // Action - Action like create/update/delete. - Action *string `json:"action,omitempty"` - // ObjectKey - Identifier of the entity being created/updated/deleted. - ObjectKey *string `json:"objectKey,omitempty"` -} - -// OperationTagResourceContractProperties operation Entity contract Properties. -type OperationTagResourceContractProperties struct { - // ID - Identifier of the operation in form /operations/{operationId}. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Operation name. - Name *string `json:"name,omitempty"` - // APIName - READ-ONLY; API Name. - APIName *string `json:"apiName,omitempty"` - // APIRevision - READ-ONLY; API Revision. - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - READ-ONLY; API Version. - APIVersion *string `json:"apiVersion,omitempty"` - // Description - READ-ONLY; Operation Description. - Description *string `json:"description,omitempty"` - // Method - READ-ONLY; A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. - Method *string `json:"method,omitempty"` - // URLTemplate - READ-ONLY; Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date} - URLTemplate *string `json:"urlTemplate,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationTagResourceContractProperties. -func (otrcp OperationTagResourceContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if otrcp.ID != nil { - objectMap["id"] = otrcp.ID - } - return json.Marshal(objectMap) -} - -// OperationUpdateContract API Operation Update Contract details. -type OperationUpdateContract struct { - // OperationUpdateContractProperties - Properties of the API Operation entity that can be updated. - *OperationUpdateContractProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationUpdateContract. -func (ouc OperationUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ouc.OperationUpdateContractProperties != nil { - objectMap["properties"] = ouc.OperationUpdateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationUpdateContract struct. -func (ouc *OperationUpdateContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var operationUpdateContractProperties OperationUpdateContractProperties - err = json.Unmarshal(*v, &operationUpdateContractProperties) - if err != nil { - return err - } - ouc.OperationUpdateContractProperties = &operationUpdateContractProperties - } - } - } - - return nil -} - -// OperationUpdateContractProperties operation Update Contract Properties. -type OperationUpdateContractProperties struct { - // DisplayName - Operation Name. - DisplayName *string `json:"displayName,omitempty"` - // Method - A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. - Method *string `json:"method,omitempty"` - // URLTemplate - Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date} - URLTemplate *string `json:"urlTemplate,omitempty"` - // TemplateParameters - Collection of URL template parameters. - TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` - // Description - Description of the operation. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Request - An entity containing request details. - Request *RequestContract `json:"request,omitempty"` - // Responses - Array of Operation responses. - Responses *[]ResponseContract `json:"responses,omitempty"` - // Policies - Operation Policies - Policies *string `json:"policies,omitempty"` -} - -// OutboundEnvironmentEndpoint endpoints accessed for a common purpose that the Api Management Service -// requires outbound network access to. -type OutboundEnvironmentEndpoint struct { - // Category - The type of service accessed by the Api Management Service, e.g., Azure Storage, Azure SQL Database, and Azure Active Directory. - Category *string `json:"category,omitempty"` - // Endpoints - The endpoints that the Api Management Service reaches the service at. - Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` -} - -// OutboundEnvironmentEndpointList collection of Outbound Environment Endpoints -type OutboundEnvironmentEndpointList struct { - autorest.Response `json:"-"` - // Value - Collection of resources. - Value *[]OutboundEnvironmentEndpoint `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to next page of resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OutboundEnvironmentEndpointList. -func (oeel OutboundEnvironmentEndpointList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oeel.Value != nil { - objectMap["value"] = oeel.Value - } - return json.Marshal(objectMap) -} - -// ParameterContract operation parameters details. -type ParameterContract struct { - // Name - Parameter name. - Name *string `json:"name,omitempty"` - // Description - Parameter description. - Description *string `json:"description,omitempty"` - // Type - Parameter type. - Type *string `json:"type,omitempty"` - // DefaultValue - Default parameter value. - DefaultValue *string `json:"defaultValue,omitempty"` - // Required - Specifies whether parameter is required or not. - Required *bool `json:"required,omitempty"` - // Values - Parameter values. - Values *[]string `json:"values,omitempty"` - // SchemaID - Schema identifier. - SchemaID *string `json:"schemaId,omitempty"` - // TypeName - Type name defined by the schema. - TypeName *string `json:"typeName,omitempty"` - // Examples - Exampled defined for the parameter. - Examples map[string]*ParameterExampleContract `json:"examples"` -} - -// MarshalJSON is the custom marshaler for ParameterContract. -func (pc ParameterContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pc.Name != nil { - objectMap["name"] = pc.Name - } - if pc.Description != nil { - objectMap["description"] = pc.Description - } - if pc.Type != nil { - objectMap["type"] = pc.Type - } - if pc.DefaultValue != nil { - objectMap["defaultValue"] = pc.DefaultValue - } - if pc.Required != nil { - objectMap["required"] = pc.Required - } - if pc.Values != nil { - objectMap["values"] = pc.Values - } - if pc.SchemaID != nil { - objectMap["schemaId"] = pc.SchemaID - } - if pc.TypeName != nil { - objectMap["typeName"] = pc.TypeName - } - if pc.Examples != nil { - objectMap["examples"] = pc.Examples - } - return json.Marshal(objectMap) -} - -// ParameterExampleContract parameter example. -type ParameterExampleContract struct { - // Summary - Short description for the example - Summary *string `json:"summary,omitempty"` - // Description - Long description for the example - Description *string `json:"description,omitempty"` - // Value - Example value. May be a primitive value, or an object. - Value interface{} `json:"value,omitempty"` - // ExternalValue - A URL that points to the literal example - ExternalValue *string `json:"externalValue,omitempty"` -} - -// PerformConnectivityCheckAsyncFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PerformConnectivityCheckAsyncFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BaseClient) (ConnectivityCheckResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PerformConnectivityCheckAsyncFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PerformConnectivityCheckAsyncFuture.Result. -func (future *PerformConnectivityCheckAsyncFuture) result(client BaseClient) (ccr ConnectivityCheckResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PerformConnectivityCheckAsyncFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ccr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.PerformConnectivityCheckAsyncFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ccr.Response.Response, err = future.GetResult(sender); err == nil && ccr.Response.Response.StatusCode != http.StatusNoContent { - ccr, err = client.PerformConnectivityCheckAsyncResponder(ccr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PerformConnectivityCheckAsyncFuture", "Result", ccr.Response.Response, "Failure responding to request") - } - } - return -} - -// PipelineDiagnosticSettings diagnostic settings for incoming/outgoing HTTP messages to the Gateway. -type PipelineDiagnosticSettings struct { - // Request - Diagnostic settings for request. - Request *HTTPMessageDiagnostic `json:"request,omitempty"` - // Response - Diagnostic settings for response. - Response *HTTPMessageDiagnostic `json:"response,omitempty"` -} - -// PolicyCollection the response of the list policy operation. -type PolicyCollection struct { - autorest.Response `json:"-"` - // Value - Policy Contract value. - Value *[]PolicyContract `json:"value,omitempty"` - // Count - Total record count number. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// PolicyContract policy Contract details. -type PolicyContract struct { - autorest.Response `json:"-"` - // PolicyContractProperties - Properties of the Policy. - *PolicyContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyContract. -func (pc PolicyContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pc.PolicyContractProperties != nil { - objectMap["properties"] = pc.PolicyContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PolicyContract struct. -func (pc *PolicyContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var policyContractProperties PolicyContractProperties - err = json.Unmarshal(*v, &policyContractProperties) - if err != nil { - return err - } - pc.PolicyContractProperties = &policyContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pc.Type = &typeVar - } - } - } - - return nil -} - -// PolicyContractProperties policy contract Properties. -type PolicyContractProperties struct { - // Value - Contents of the Policy as defined by the format. - Value *string `json:"value,omitempty"` - // Format - Format of the policyContent. Possible values include: 'PolicyContentFormatXML', 'PolicyContentFormatXMLLink', 'PolicyContentFormatRawxml', 'PolicyContentFormatRawxmlLink' - Format PolicyContentFormat `json:"format,omitempty"` -} - -// PolicyDescriptionCollection descriptions of APIM policies. -type PolicyDescriptionCollection struct { - autorest.Response `json:"-"` - // Value - Descriptions of APIM policies. - Value *[]PolicyDescriptionContract `json:"value,omitempty"` - // Count - Total record count number. - Count *int64 `json:"count,omitempty"` -} - -// PolicyDescriptionContract policy description details. -type PolicyDescriptionContract struct { - // PolicyDescriptionContractProperties - Policy description contract properties. - *PolicyDescriptionContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyDescriptionContract. -func (pdc PolicyDescriptionContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pdc.PolicyDescriptionContractProperties != nil { - objectMap["properties"] = pdc.PolicyDescriptionContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PolicyDescriptionContract struct. -func (pdc *PolicyDescriptionContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var policyDescriptionContractProperties PolicyDescriptionContractProperties - err = json.Unmarshal(*v, &policyDescriptionContractProperties) - if err != nil { - return err - } - pdc.PolicyDescriptionContractProperties = &policyDescriptionContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pdc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pdc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pdc.Type = &typeVar - } - } - } - - return nil -} - -// PolicyDescriptionContractProperties policy description properties. -type PolicyDescriptionContractProperties struct { - // Description - READ-ONLY; Policy description. - Description *string `json:"description,omitempty"` - // Scope - READ-ONLY; Binary OR value of the Snippet scope. - Scope *int64 `json:"scope,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyDescriptionContractProperties. -func (pdcp PolicyDescriptionContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PortalDelegationSettings delegation settings for a developer portal. -type PortalDelegationSettings struct { - autorest.Response `json:"-"` - // PortalDelegationSettingsProperties - Delegation settings contract properties. - *PortalDelegationSettingsProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PortalDelegationSettings. -func (pds PortalDelegationSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pds.PortalDelegationSettingsProperties != nil { - objectMap["properties"] = pds.PortalDelegationSettingsProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PortalDelegationSettings struct. -func (pds *PortalDelegationSettings) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var portalDelegationSettingsProperties PortalDelegationSettingsProperties - err = json.Unmarshal(*v, &portalDelegationSettingsProperties) - if err != nil { - return err - } - pds.PortalDelegationSettingsProperties = &portalDelegationSettingsProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pds.Type = &typeVar - } - } - } - - return nil -} - -// PortalDelegationSettingsProperties delegation settings contract properties. -type PortalDelegationSettingsProperties struct { - // URL - A delegation Url. - URL *string `json:"url,omitempty"` - // ValidationKey - A base64-encoded validation key to validate, that a request is coming from Azure API Management. - ValidationKey *string `json:"validationKey,omitempty"` - // Subscriptions - Subscriptions delegation settings. - Subscriptions *SubscriptionsDelegationSettingsProperties `json:"subscriptions,omitempty"` - // UserRegistration - User registration delegation settings. - UserRegistration *RegistrationDelegationSettingsProperties `json:"userRegistration,omitempty"` -} - -// PortalRevisionCollection paged list of portal revisions. -type PortalRevisionCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Collection of portal revisions. - Value *[]PortalRevisionContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link, if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PortalRevisionCollection. -func (prc PortalRevisionCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PortalRevisionCollectionIterator provides access to a complete listing of PortalRevisionContract values. -type PortalRevisionCollectionIterator struct { - i int - page PortalRevisionCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PortalRevisionCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PortalRevisionCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PortalRevisionCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PortalRevisionCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PortalRevisionCollectionIterator) Response() PortalRevisionCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PortalRevisionCollectionIterator) Value() PortalRevisionContract { - if !iter.page.NotDone() { - return PortalRevisionContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PortalRevisionCollectionIterator type. -func NewPortalRevisionCollectionIterator(page PortalRevisionCollectionPage) PortalRevisionCollectionIterator { - return PortalRevisionCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (prc PortalRevisionCollection) IsEmpty() bool { - return prc.Value == nil || len(*prc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (prc PortalRevisionCollection) hasNextLink() bool { - return prc.NextLink != nil && len(*prc.NextLink) != 0 -} - -// portalRevisionCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (prc PortalRevisionCollection) portalRevisionCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !prc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(prc.NextLink))) -} - -// PortalRevisionCollectionPage contains a page of PortalRevisionContract values. -type PortalRevisionCollectionPage struct { - fn func(context.Context, PortalRevisionCollection) (PortalRevisionCollection, error) - prc PortalRevisionCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PortalRevisionCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PortalRevisionCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.prc) - if err != nil { - return err - } - page.prc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PortalRevisionCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PortalRevisionCollectionPage) NotDone() bool { - return !page.prc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PortalRevisionCollectionPage) Response() PortalRevisionCollection { - return page.prc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PortalRevisionCollectionPage) Values() []PortalRevisionContract { - if page.prc.IsEmpty() { - return nil - } - return *page.prc.Value -} - -// Creates a new instance of the PortalRevisionCollectionPage type. -func NewPortalRevisionCollectionPage(cur PortalRevisionCollection, getNextPage func(context.Context, PortalRevisionCollection) (PortalRevisionCollection, error)) PortalRevisionCollectionPage { - return PortalRevisionCollectionPage{ - fn: getNextPage, - prc: cur, - } -} - -// PortalRevisionContract portal Revision's contract details. -type PortalRevisionContract struct { - autorest.Response `json:"-"` - // PortalRevisionContractProperties - Properties of the portal revisions. - *PortalRevisionContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PortalRevisionContract. -func (prc PortalRevisionContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if prc.PortalRevisionContractProperties != nil { - objectMap["properties"] = prc.PortalRevisionContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PortalRevisionContract struct. -func (prc *PortalRevisionContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var portalRevisionContractProperties PortalRevisionContractProperties - err = json.Unmarshal(*v, &portalRevisionContractProperties) - if err != nil { - return err - } - prc.PortalRevisionContractProperties = &portalRevisionContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - prc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - prc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - prc.Type = &typeVar - } - } - } - - return nil -} - -// PortalRevisionContractProperties ... -type PortalRevisionContractProperties struct { - // Description - Portal revision description. - Description *string `json:"description,omitempty"` - // StatusDetails - READ-ONLY; Portal revision publishing status details. - StatusDetails *string `json:"statusDetails,omitempty"` - // Status - READ-ONLY; Status of the portal's revision. Possible values include: 'PortalRevisionStatusPending', 'PortalRevisionStatusPublishing', 'PortalRevisionStatusCompleted', 'PortalRevisionStatusFailed' - Status PortalRevisionStatus `json:"status,omitempty"` - // IsCurrent - Indicates if the portal's revision is public. - IsCurrent *bool `json:"isCurrent,omitempty"` - // CreatedDateTime - READ-ONLY; Portal's revision creation date and time. - CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` - // UpdatedDateTime - READ-ONLY; Last updated date and time. - UpdatedDateTime *date.Time `json:"updatedDateTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for PortalRevisionContractProperties. -func (prcp PortalRevisionContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if prcp.Description != nil { - objectMap["description"] = prcp.Description - } - if prcp.IsCurrent != nil { - objectMap["isCurrent"] = prcp.IsCurrent - } - return json.Marshal(objectMap) -} - -// PortalRevisionCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PortalRevisionCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PortalRevisionClient) (PortalRevisionContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PortalRevisionCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PortalRevisionCreateOrUpdateFuture.Result. -func (future *PortalRevisionCreateOrUpdateFuture) result(client PortalRevisionClient) (prc PortalRevisionContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - prc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.PortalRevisionCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if prc.Response.Response, err = future.GetResult(sender); err == nil && prc.Response.Response.StatusCode != http.StatusNoContent { - prc, err = client.CreateOrUpdateResponder(prc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionCreateOrUpdateFuture", "Result", prc.Response.Response, "Failure responding to request") - } - } - return -} - -// PortalRevisionUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PortalRevisionUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PortalRevisionClient) (PortalRevisionContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PortalRevisionUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PortalRevisionUpdateFuture.Result. -func (future *PortalRevisionUpdateFuture) result(client PortalRevisionClient) (prc PortalRevisionContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - prc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.PortalRevisionUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if prc.Response.Response, err = future.GetResult(sender); err == nil && prc.Response.Response.StatusCode != http.StatusNoContent { - prc, err = client.UpdateResponder(prc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionUpdateFuture", "Result", prc.Response.Response, "Failure responding to request") - } - } - return -} - -// PortalSettingsCollection descriptions of APIM policies. -type PortalSettingsCollection struct { - autorest.Response `json:"-"` - // Value - Descriptions of APIM policies. - Value *[]PortalSettingsContract `json:"value,omitempty"` - // Count - Total record count number. - Count *int64 `json:"count,omitempty"` -} - -// PortalSettingsContract portal Settings for the Developer Portal. -type PortalSettingsContract struct { - // PortalSettingsContractProperties - Portal Settings contract properties. - *PortalSettingsContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PortalSettingsContract. -func (psc PortalSettingsContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if psc.PortalSettingsContractProperties != nil { - objectMap["properties"] = psc.PortalSettingsContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PortalSettingsContract struct. -func (psc *PortalSettingsContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var portalSettingsContractProperties PortalSettingsContractProperties - err = json.Unmarshal(*v, &portalSettingsContractProperties) - if err != nil { - return err - } - psc.PortalSettingsContractProperties = &portalSettingsContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - psc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - psc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - psc.Type = &typeVar - } - } - } - - return nil -} - -// PortalSettingsContractProperties sign-in settings contract properties. -type PortalSettingsContractProperties struct { - // URL - A delegation Url. - URL *string `json:"url,omitempty"` - // ValidationKey - A base64-encoded validation key to validate, that a request is coming from Azure API Management. - ValidationKey *string `json:"validationKey,omitempty"` - // Subscriptions - Subscriptions delegation settings. - Subscriptions *SubscriptionsDelegationSettingsProperties `json:"subscriptions,omitempty"` - // UserRegistration - User registration delegation settings. - UserRegistration *RegistrationDelegationSettingsProperties `json:"userRegistration,omitempty"` - // Enabled - Redirect Anonymous users to the Sign-In page. - Enabled *bool `json:"enabled,omitempty"` - // TermsOfService - Terms of service contract properties. - TermsOfService *TermsOfServiceProperties `json:"termsOfService,omitempty"` -} - -// PortalSettingValidationKeyContract client or app secret used in IdentityProviders, Aad, OpenID or OAuth. -type PortalSettingValidationKeyContract struct { - autorest.Response `json:"-"` - // ValidationKey - This is secret value of the validation key in portal settings. - ValidationKey *string `json:"validationKey,omitempty"` -} - -// PortalSigninSettingProperties sign-in settings contract properties. -type PortalSigninSettingProperties struct { - // Enabled - Redirect Anonymous users to the Sign-In page. - Enabled *bool `json:"enabled,omitempty"` -} - -// PortalSigninSettings sign-In settings for the Developer Portal. -type PortalSigninSettings struct { - autorest.Response `json:"-"` - // PortalSigninSettingProperties - Sign-in settings contract properties. - *PortalSigninSettingProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PortalSigninSettings. -func (pss PortalSigninSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pss.PortalSigninSettingProperties != nil { - objectMap["properties"] = pss.PortalSigninSettingProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PortalSigninSettings struct. -func (pss *PortalSigninSettings) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var portalSigninSettingProperties PortalSigninSettingProperties - err = json.Unmarshal(*v, &portalSigninSettingProperties) - if err != nil { - return err - } - pss.PortalSigninSettingProperties = &portalSigninSettingProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pss.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pss.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pss.Type = &typeVar - } - } - } - - return nil -} - -// PortalSignupSettings sign-Up settings for a developer portal. -type PortalSignupSettings struct { - autorest.Response `json:"-"` - // PortalSignupSettingsProperties - Sign-up settings contract properties. - *PortalSignupSettingsProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PortalSignupSettings. -func (pss PortalSignupSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pss.PortalSignupSettingsProperties != nil { - objectMap["properties"] = pss.PortalSignupSettingsProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PortalSignupSettings struct. -func (pss *PortalSignupSettings) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var portalSignupSettingsProperties PortalSignupSettingsProperties - err = json.Unmarshal(*v, &portalSignupSettingsProperties) - if err != nil { - return err - } - pss.PortalSignupSettingsProperties = &portalSignupSettingsProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pss.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pss.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pss.Type = &typeVar - } - } - } - - return nil -} - -// PortalSignupSettingsProperties sign-up settings contract properties. -type PortalSignupSettingsProperties struct { - // Enabled - Allow users to sign up on a developer portal. - Enabled *bool `json:"enabled,omitempty"` - // TermsOfService - Terms of service contract properties. - TermsOfService *TermsOfServiceProperties `json:"termsOfService,omitempty"` -} - -// PrivateEndpoint the Private Endpoint resource. -type PrivateEndpoint struct { - // ID - READ-ONLY; The ARM identifier for Private Endpoint - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpoint. -func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection the Private Endpoint Connection resource. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - } - } - - return nil -} - -// PrivateEndpointConnectionCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionCreateOrUpdateFuture) result(client PrivateEndpointConnectionClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.PrivateEndpointConnectionCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionDeleteFuture.Result. -func (future *PrivateEndpointConnectionDeleteFuture) result(client PrivateEndpointConnectionClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.PrivateEndpointConnectionDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointConnectionListResult list of private endpoint connection associated with the specified -// storage account -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of the PrivateEndpointConnectProperties. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The resource of private end point. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - The provisioning state of the private endpoint connection resource. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' - ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionRequest a request to approve or reject a private endpoint connection -type PrivateEndpointConnectionRequest struct { - // ID - Private Endpoint Connection Resource Id. - ID *string `json:"id,omitempty"` - // Properties - The connection state of the private endpoint connection. - Properties *PrivateEndpointConnectionRequestProperties `json:"properties,omitempty"` -} - -// PrivateEndpointConnectionRequestProperties the connection state of the private endpoint connection. -type PrivateEndpointConnectionRequestProperties struct { - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` -} - -// PrivateEndpointConnectionWrapperProperties properties of the PrivateEndpointConnectProperties. -type PrivateEndpointConnectionWrapperProperties struct { - // PrivateEndpoint - The resource of private end point. - PrivateEndpoint *ArmIDWrapper `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the private endpoint connection resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // GroupIds - READ-ONLY; All the Group ids. - GroupIds *[]string `json:"groupIds,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionWrapperProperties. -func (pecwp PrivateEndpointConnectionWrapperProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecwp.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = pecwp.PrivateEndpoint - } - if pecwp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = pecwp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.PrivateLinkResourceProperties != nil { - objectMap["properties"] = plr.PrivateLinkResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. -func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - The private link resource Private link DNS zone name. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plrp.RequiredZoneNames != nil { - objectMap["requiredZoneNames"] = plrp.RequiredZoneNames - } - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionState a collection of information about the state of the connection between -// service consumer and provider. -type PrivateLinkServiceConnectionState struct { - // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'PrivateEndpointServiceConnectionStatusPending', 'PrivateEndpointServiceConnectionStatusApproved', 'PrivateEndpointServiceConnectionStatusRejected' - Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` - // Description - The reason for approval/rejection of the connection. - Description *string `json:"description,omitempty"` - // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// ProductCollection paged Products list representation. -type ProductCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]ProductContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ProductCollectionIterator provides access to a complete listing of ProductContract values. -type ProductCollectionIterator struct { - i int - page ProductCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ProductCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ProductCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ProductCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ProductCollectionIterator) Response() ProductCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ProductCollectionIterator) Value() ProductContract { - if !iter.page.NotDone() { - return ProductContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ProductCollectionIterator type. -func NewProductCollectionIterator(page ProductCollectionPage) ProductCollectionIterator { - return ProductCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pc ProductCollection) IsEmpty() bool { - return pc.Value == nil || len(*pc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pc ProductCollection) hasNextLink() bool { - return pc.NextLink != nil && len(*pc.NextLink) != 0 -} - -// productCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pc ProductCollection) productCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !pc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pc.NextLink))) -} - -// ProductCollectionPage contains a page of ProductContract values. -type ProductCollectionPage struct { - fn func(context.Context, ProductCollection) (ProductCollection, error) - pc ProductCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ProductCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.pc) - if err != nil { - return err - } - page.pc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ProductCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ProductCollectionPage) NotDone() bool { - return !page.pc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ProductCollectionPage) Response() ProductCollection { - return page.pc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ProductCollectionPage) Values() []ProductContract { - if page.pc.IsEmpty() { - return nil - } - return *page.pc.Value -} - -// Creates a new instance of the ProductCollectionPage type. -func NewProductCollectionPage(cur ProductCollection, getNextPage func(context.Context, ProductCollection) (ProductCollection, error)) ProductCollectionPage { - return ProductCollectionPage{ - fn: getNextPage, - pc: cur, - } -} - -// ProductContract product details. -type ProductContract struct { - autorest.Response `json:"-"` - // ProductContractProperties - Product entity contract properties. - *ProductContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProductContract. -func (pc ProductContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pc.ProductContractProperties != nil { - objectMap["properties"] = pc.ProductContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ProductContract struct. -func (pc *ProductContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var productContractProperties ProductContractProperties - err = json.Unmarshal(*v, &productContractProperties) - if err != nil { - return err - } - pc.ProductContractProperties = &productContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pc.Type = &typeVar - } - } - } - - return nil -} - -// ProductContractProperties product profile. -type ProductContractProperties struct { - // DisplayName - Product name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Product description. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Terms - Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - Terms *string `json:"terms,omitempty"` - // SubscriptionRequired - Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // ApprovalRequired - whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false. - ApprovalRequired *bool `json:"approvalRequired,omitempty"` - // SubscriptionsLimit - Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false. - SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` - // State - whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'ProductStateNotPublished', 'ProductStatePublished' - State ProductState `json:"state,omitempty"` -} - -// ProductEntityBaseParameters product Entity Base Parameters -type ProductEntityBaseParameters struct { - // Description - Product description. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Terms - Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - Terms *string `json:"terms,omitempty"` - // SubscriptionRequired - Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // ApprovalRequired - whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false. - ApprovalRequired *bool `json:"approvalRequired,omitempty"` - // SubscriptionsLimit - Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false. - SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` - // State - whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'ProductStateNotPublished', 'ProductStatePublished' - State ProductState `json:"state,omitempty"` -} - -// ProductTagResourceContractProperties product profile. -type ProductTagResourceContractProperties struct { - // ID - Identifier of the product in the form of /products/{productId} - ID *string `json:"id,omitempty"` - // Name - Product name. - Name *string `json:"name,omitempty"` - // Description - Product description. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Terms - Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - Terms *string `json:"terms,omitempty"` - // SubscriptionRequired - Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // ApprovalRequired - whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false. - ApprovalRequired *bool `json:"approvalRequired,omitempty"` - // SubscriptionsLimit - Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false. - SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` - // State - whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'ProductStateNotPublished', 'ProductStatePublished' - State ProductState `json:"state,omitempty"` -} - -// ProductUpdateParameters product Update parameters. -type ProductUpdateParameters struct { - // ProductUpdateProperties - Product entity Update contract properties. - *ProductUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProductUpdateParameters. -func (pup ProductUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pup.ProductUpdateProperties != nil { - objectMap["properties"] = pup.ProductUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ProductUpdateParameters struct. -func (pup *ProductUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var productUpdateProperties ProductUpdateProperties - err = json.Unmarshal(*v, &productUpdateProperties) - if err != nil { - return err - } - pup.ProductUpdateProperties = &productUpdateProperties - } - } - } - - return nil -} - -// ProductUpdateProperties parameters supplied to the Update Product operation. -type ProductUpdateProperties struct { - // DisplayName - Product name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Product description. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Terms - Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - Terms *string `json:"terms,omitempty"` - // SubscriptionRequired - Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // ApprovalRequired - whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false. - ApprovalRequired *bool `json:"approvalRequired,omitempty"` - // SubscriptionsLimit - Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false. - SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` - // State - whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'ProductStateNotPublished', 'ProductStatePublished' - State ProductState `json:"state,omitempty"` -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// QuotaCounterCollection paged Quota Counter list representation. -type QuotaCounterCollection struct { - autorest.Response `json:"-"` - // Value - Quota counter values. - Value *[]QuotaCounterContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// QuotaCounterContract quota counter details. -type QuotaCounterContract struct { - autorest.Response `json:"-"` - // CounterKey - The Key value of the Counter. Must not be empty. - CounterKey *string `json:"counterKey,omitempty"` - // PeriodKey - Identifier of the Period for which the counter was collected. Must not be empty. - PeriodKey *string `json:"periodKey,omitempty"` - // PeriodStartTime - The date of the start of Counter Period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - PeriodStartTime *date.Time `json:"periodStartTime,omitempty"` - // PeriodEndTime - The date of the end of Counter Period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - PeriodEndTime *date.Time `json:"periodEndTime,omitempty"` - // Value - Quota Value Properties - Value *QuotaCounterValueContractProperties `json:"value,omitempty"` -} - -// QuotaCounterValueContract quota counter value details. -type QuotaCounterValueContract struct { - // QuotaCounterValueContractProperties - Quota counter Value Properties. - *QuotaCounterValueContractProperties `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for QuotaCounterValueContract. -func (qcvc QuotaCounterValueContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if qcvc.QuotaCounterValueContractProperties != nil { - objectMap["value"] = qcvc.QuotaCounterValueContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for QuotaCounterValueContract struct. -func (qcvc *QuotaCounterValueContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "value": - if v != nil { - var quotaCounterValueContractProperties QuotaCounterValueContractProperties - err = json.Unmarshal(*v, "aCounterValueContractProperties) - if err != nil { - return err - } - qcvc.QuotaCounterValueContractProperties = "aCounterValueContractProperties - } - } - } - - return nil -} - -// QuotaCounterValueContractProperties quota counter value details. -type QuotaCounterValueContractProperties struct { - // CallsCount - Number of times Counter was called. - CallsCount *int32 `json:"callsCount,omitempty"` - // KbTransferred - Data Transferred in KiloBytes. - KbTransferred *float64 `json:"kbTransferred,omitempty"` -} - -// QuotaCounterValueUpdateContract quota counter value details. -type QuotaCounterValueUpdateContract struct { - // QuotaCounterValueContractProperties - Quota counter value details. - *QuotaCounterValueContractProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for QuotaCounterValueUpdateContract. -func (qcvuc QuotaCounterValueUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if qcvuc.QuotaCounterValueContractProperties != nil { - objectMap["properties"] = qcvuc.QuotaCounterValueContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for QuotaCounterValueUpdateContract struct. -func (qcvuc *QuotaCounterValueUpdateContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var quotaCounterValueContractProperties QuotaCounterValueContractProperties - err = json.Unmarshal(*v, "aCounterValueContractProperties) - if err != nil { - return err - } - qcvuc.QuotaCounterValueContractProperties = "aCounterValueContractProperties - } - } - } - - return nil -} - -// RecipientEmailCollection paged Recipient User list representation. -type RecipientEmailCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]RecipientEmailContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// RecipientEmailContract recipient Email details. -type RecipientEmailContract struct { - autorest.Response `json:"-"` - // RecipientEmailContractProperties - Recipient Email contract properties. - *RecipientEmailContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecipientEmailContract. -func (rec RecipientEmailContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rec.RecipientEmailContractProperties != nil { - objectMap["properties"] = rec.RecipientEmailContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecipientEmailContract struct. -func (rec *RecipientEmailContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var recipientEmailContractProperties RecipientEmailContractProperties - err = json.Unmarshal(*v, &recipientEmailContractProperties) - if err != nil { - return err - } - rec.RecipientEmailContractProperties = &recipientEmailContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rec.Type = &typeVar - } - } - } - - return nil -} - -// RecipientEmailContractProperties recipient Email Contract Properties. -type RecipientEmailContractProperties struct { - // Email - User Email subscribed to notification. - Email *string `json:"email,omitempty"` -} - -// RecipientsContractProperties notification Parameter contract. -type RecipientsContractProperties struct { - // Emails - List of Emails subscribed for the notification. - Emails *[]string `json:"emails,omitempty"` - // Users - List of Users subscribed for the notification. - Users *[]string `json:"users,omitempty"` -} - -// RecipientUserCollection paged Recipient User list representation. -type RecipientUserCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]RecipientUserContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// RecipientUserContract recipient User details. -type RecipientUserContract struct { - autorest.Response `json:"-"` - // RecipientUsersContractProperties - Recipient User entity contract properties. - *RecipientUsersContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecipientUserContract. -func (ruc RecipientUserContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ruc.RecipientUsersContractProperties != nil { - objectMap["properties"] = ruc.RecipientUsersContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecipientUserContract struct. -func (ruc *RecipientUserContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var recipientUsersContractProperties RecipientUsersContractProperties - err = json.Unmarshal(*v, &recipientUsersContractProperties) - if err != nil { - return err - } - ruc.RecipientUsersContractProperties = &recipientUsersContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ruc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ruc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ruc.Type = &typeVar - } - } - } - - return nil -} - -// RecipientUsersContractProperties recipient User Contract Properties. -type RecipientUsersContractProperties struct { - // UserID - API Management UserId subscribed to notification. - UserID *string `json:"userId,omitempty"` -} - -// RegionContract region profile. -type RegionContract struct { - // Name - READ-ONLY; Region name. - Name *string `json:"name,omitempty"` - // IsMasterRegion - whether Region is the master region. - IsMasterRegion *bool `json:"isMasterRegion,omitempty"` - // IsDeleted - whether Region is deleted. - IsDeleted *bool `json:"isDeleted,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegionContract. -func (rc RegionContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rc.IsMasterRegion != nil { - objectMap["isMasterRegion"] = rc.IsMasterRegion - } - if rc.IsDeleted != nil { - objectMap["isDeleted"] = rc.IsDeleted - } - return json.Marshal(objectMap) -} - -// RegionListResult lists Regions operation response details. -type RegionListResult struct { - autorest.Response `json:"-"` - // Value - Lists of Regions. - Value *[]RegionContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// RegionListResultIterator provides access to a complete listing of RegionContract values. -type RegionListResultIterator struct { - i int - page RegionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RegionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RegionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RegionListResultIterator) Response() RegionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RegionListResultIterator) Value() RegionContract { - if !iter.page.NotDone() { - return RegionContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RegionListResultIterator type. -func NewRegionListResultIterator(page RegionListResultPage) RegionListResultIterator { - return RegionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RegionListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RegionListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// regionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RegionListResult) regionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rlr.NextLink))) -} - -// RegionListResultPage contains a page of RegionContract values. -type RegionListResultPage struct { - fn func(context.Context, RegionListResult) (RegionListResult, error) - rlr RegionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RegionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rlr) - if err != nil { - return err - } - page.rlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RegionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RegionListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RegionListResultPage) Response() RegionListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RegionListResultPage) Values() []RegionContract { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RegionListResultPage type. -func NewRegionListResultPage(cur RegionListResult, getNextPage func(context.Context, RegionListResult) (RegionListResult, error)) RegionListResultPage { - return RegionListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RegistrationDelegationSettingsProperties user registration delegation settings properties. -type RegistrationDelegationSettingsProperties struct { - // Enabled - Enable or disable delegation for user registration. - Enabled *bool `json:"enabled,omitempty"` -} - -// RemotePrivateEndpointConnectionWrapper remote Private Endpoint Connection resource. -type RemotePrivateEndpointConnectionWrapper struct { - // ID - Private Endpoint connection resource id - ID *string `json:"id,omitempty"` - // Name - Private Endpoint Connection Name - Name *string `json:"name,omitempty"` - // Type - Private Endpoint Connection Resource Type - Type *string `json:"type,omitempty"` - // PrivateEndpointConnectionWrapperProperties - Resource properties. - *PrivateEndpointConnectionWrapperProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for RemotePrivateEndpointConnectionWrapper. -func (rpecw RemotePrivateEndpointConnectionWrapper) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rpecw.ID != nil { - objectMap["id"] = rpecw.ID - } - if rpecw.Name != nil { - objectMap["name"] = rpecw.Name - } - if rpecw.Type != nil { - objectMap["type"] = rpecw.Type - } - if rpecw.PrivateEndpointConnectionWrapperProperties != nil { - objectMap["properties"] = rpecw.PrivateEndpointConnectionWrapperProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RemotePrivateEndpointConnectionWrapper struct. -func (rpecw *RemotePrivateEndpointConnectionWrapper) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rpecw.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rpecw.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rpecw.Type = &typeVar - } - case "properties": - if v != nil { - var privateEndpointConnectionWrapperProperties PrivateEndpointConnectionWrapperProperties - err = json.Unmarshal(*v, &privateEndpointConnectionWrapperProperties) - if err != nil { - return err - } - rpecw.PrivateEndpointConnectionWrapperProperties = &privateEndpointConnectionWrapperProperties - } - } - } - - return nil -} - -// ReportCollection paged Report records list representation. -type ReportCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]ReportRecordContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ReportCollectionIterator provides access to a complete listing of ReportRecordContract values. -type ReportCollectionIterator struct { - i int - page ReportCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ReportCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ReportCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ReportCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ReportCollectionIterator) Response() ReportCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ReportCollectionIterator) Value() ReportRecordContract { - if !iter.page.NotDone() { - return ReportRecordContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ReportCollectionIterator type. -func NewReportCollectionIterator(page ReportCollectionPage) ReportCollectionIterator { - return ReportCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rc ReportCollection) IsEmpty() bool { - return rc.Value == nil || len(*rc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rc ReportCollection) hasNextLink() bool { - return rc.NextLink != nil && len(*rc.NextLink) != 0 -} - -// reportCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rc ReportCollection) reportCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !rc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rc.NextLink))) -} - -// ReportCollectionPage contains a page of ReportRecordContract values. -type ReportCollectionPage struct { - fn func(context.Context, ReportCollection) (ReportCollection, error) - rc ReportCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ReportCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rc) - if err != nil { - return err - } - page.rc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ReportCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ReportCollectionPage) NotDone() bool { - return !page.rc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ReportCollectionPage) Response() ReportCollection { - return page.rc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ReportCollectionPage) Values() []ReportRecordContract { - if page.rc.IsEmpty() { - return nil - } - return *page.rc.Value -} - -// Creates a new instance of the ReportCollectionPage type. -func NewReportCollectionPage(cur ReportCollection, getNextPage func(context.Context, ReportCollection) (ReportCollection, error)) ReportCollectionPage { - return ReportCollectionPage{ - fn: getNextPage, - rc: cur, - } -} - -// ReportRecordContract report data. -type ReportRecordContract struct { - // Name - Name depending on report endpoint specifies product, API, operation or developer name. - Name *string `json:"name,omitempty"` - // Timestamp - Start of aggregation period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Interval - Length of aggregation period. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations). - Interval *string `json:"interval,omitempty"` - // Country - Country to which this record data is related. - Country *string `json:"country,omitempty"` - // Region - Country region to which this record data is related. - Region *string `json:"region,omitempty"` - // Zip - Zip code to which this record data is related. - Zip *string `json:"zip,omitempty"` - // UserID - READ-ONLY; User identifier path. /users/{userId} - UserID *string `json:"userId,omitempty"` - // ProductID - READ-ONLY; Product identifier path. /products/{productId} - ProductID *string `json:"productId,omitempty"` - // APIID - API identifier path. /apis/{apiId} - APIID *string `json:"apiId,omitempty"` - // OperationID - Operation identifier path. /apis/{apiId}/operations/{operationId} - OperationID *string `json:"operationId,omitempty"` - // APIRegion - API region identifier. - APIRegion *string `json:"apiRegion,omitempty"` - // SubscriptionID - Subscription identifier path. /subscriptions/{subscriptionId} - SubscriptionID *string `json:"subscriptionId,omitempty"` - // CallCountSuccess - Number of successful calls. This includes calls returning HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect - CallCountSuccess *int32 `json:"callCountSuccess,omitempty"` - // CallCountBlocked - Number of calls blocked due to invalid credentials. This includes calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and HttpStatusCode.TooManyRequests - CallCountBlocked *int32 `json:"callCountBlocked,omitempty"` - // CallCountFailed - Number of calls failed due to proxy or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600 - CallCountFailed *int32 `json:"callCountFailed,omitempty"` - // CallCountOther - Number of other calls. - CallCountOther *int32 `json:"callCountOther,omitempty"` - // CallCountTotal - Total number of calls. - CallCountTotal *int32 `json:"callCountTotal,omitempty"` - // Bandwidth - Bandwidth consumed. - Bandwidth *int64 `json:"bandwidth,omitempty"` - // CacheHitCount - Number of times when content was served from cache policy. - CacheHitCount *int32 `json:"cacheHitCount,omitempty"` - // CacheMissCount - Number of times content was fetched from backend. - CacheMissCount *int32 `json:"cacheMissCount,omitempty"` - // APITimeAvg - Average time it took to process request. - APITimeAvg *float64 `json:"apiTimeAvg,omitempty"` - // APITimeMin - Minimum time it took to process request. - APITimeMin *float64 `json:"apiTimeMin,omitempty"` - // APITimeMax - Maximum time it took to process request. - APITimeMax *float64 `json:"apiTimeMax,omitempty"` - // ServiceTimeAvg - Average time it took to process request on backend. - ServiceTimeAvg *float64 `json:"serviceTimeAvg,omitempty"` - // ServiceTimeMin - Minimum time it took to process request on backend. - ServiceTimeMin *float64 `json:"serviceTimeMin,omitempty"` - // ServiceTimeMax - Maximum time it took to process request on backend. - ServiceTimeMax *float64 `json:"serviceTimeMax,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReportRecordContract. -func (rrc ReportRecordContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rrc.Name != nil { - objectMap["name"] = rrc.Name - } - if rrc.Timestamp != nil { - objectMap["timestamp"] = rrc.Timestamp - } - if rrc.Interval != nil { - objectMap["interval"] = rrc.Interval - } - if rrc.Country != nil { - objectMap["country"] = rrc.Country - } - if rrc.Region != nil { - objectMap["region"] = rrc.Region - } - if rrc.Zip != nil { - objectMap["zip"] = rrc.Zip - } - if rrc.APIID != nil { - objectMap["apiId"] = rrc.APIID - } - if rrc.OperationID != nil { - objectMap["operationId"] = rrc.OperationID - } - if rrc.APIRegion != nil { - objectMap["apiRegion"] = rrc.APIRegion - } - if rrc.SubscriptionID != nil { - objectMap["subscriptionId"] = rrc.SubscriptionID - } - if rrc.CallCountSuccess != nil { - objectMap["callCountSuccess"] = rrc.CallCountSuccess - } - if rrc.CallCountBlocked != nil { - objectMap["callCountBlocked"] = rrc.CallCountBlocked - } - if rrc.CallCountFailed != nil { - objectMap["callCountFailed"] = rrc.CallCountFailed - } - if rrc.CallCountOther != nil { - objectMap["callCountOther"] = rrc.CallCountOther - } - if rrc.CallCountTotal != nil { - objectMap["callCountTotal"] = rrc.CallCountTotal - } - if rrc.Bandwidth != nil { - objectMap["bandwidth"] = rrc.Bandwidth - } - if rrc.CacheHitCount != nil { - objectMap["cacheHitCount"] = rrc.CacheHitCount - } - if rrc.CacheMissCount != nil { - objectMap["cacheMissCount"] = rrc.CacheMissCount - } - if rrc.APITimeAvg != nil { - objectMap["apiTimeAvg"] = rrc.APITimeAvg - } - if rrc.APITimeMin != nil { - objectMap["apiTimeMin"] = rrc.APITimeMin - } - if rrc.APITimeMax != nil { - objectMap["apiTimeMax"] = rrc.APITimeMax - } - if rrc.ServiceTimeAvg != nil { - objectMap["serviceTimeAvg"] = rrc.ServiceTimeAvg - } - if rrc.ServiceTimeMin != nil { - objectMap["serviceTimeMin"] = rrc.ServiceTimeMin - } - if rrc.ServiceTimeMax != nil { - objectMap["serviceTimeMax"] = rrc.ServiceTimeMax - } - return json.Marshal(objectMap) -} - -// RepresentationContract operation request/response representation details. -type RepresentationContract struct { - // ContentType - Specifies a registered or custom content type for this representation, e.g. application/xml. - ContentType *string `json:"contentType,omitempty"` - // SchemaID - Schema identifier. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. - SchemaID *string `json:"schemaId,omitempty"` - // TypeName - Type name defined by the schema. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. - TypeName *string `json:"typeName,omitempty"` - // FormParameters - Collection of form parameters. Required if 'contentType' value is either 'application/x-www-form-urlencoded' or 'multipart/form-data'.. - FormParameters *[]ParameterContract `json:"formParameters,omitempty"` - // Examples - Exampled defined for the representation. - Examples map[string]*ParameterExampleContract `json:"examples"` -} - -// MarshalJSON is the custom marshaler for RepresentationContract. -func (rc RepresentationContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rc.ContentType != nil { - objectMap["contentType"] = rc.ContentType - } - if rc.SchemaID != nil { - objectMap["schemaId"] = rc.SchemaID - } - if rc.TypeName != nil { - objectMap["typeName"] = rc.TypeName - } - if rc.FormParameters != nil { - objectMap["formParameters"] = rc.FormParameters - } - if rc.Examples != nil { - objectMap["examples"] = rc.Examples - } - return json.Marshal(objectMap) -} - -// RequestContract operation request details. -type RequestContract struct { - // Description - Operation request description. - Description *string `json:"description,omitempty"` - // QueryParameters - Collection of operation request query parameters. - QueryParameters *[]ParameterContract `json:"queryParameters,omitempty"` - // Headers - Collection of operation request headers. - Headers *[]ParameterContract `json:"headers,omitempty"` - // Representations - Collection of operation request representations. - Representations *[]RepresentationContract `json:"representations,omitempty"` -} - -// RequestReportCollection paged Report records list representation. -type RequestReportCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]RequestReportRecordContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` -} - -// RequestReportRecordContract request Report data. -type RequestReportRecordContract struct { - // APIID - API identifier path. /apis/{apiId} - APIID *string `json:"apiId,omitempty"` - // OperationID - Operation identifier path. /apis/{apiId}/operations/{operationId} - OperationID *string `json:"operationId,omitempty"` - // ProductID - READ-ONLY; Product identifier path. /products/{productId} - ProductID *string `json:"productId,omitempty"` - // UserID - READ-ONLY; User identifier path. /users/{userId} - UserID *string `json:"userId,omitempty"` - // Method - The HTTP method associated with this request.. - Method *string `json:"method,omitempty"` - // URL - The full URL associated with this request. - URL *string `json:"url,omitempty"` - // IPAddress - The client IP address associated with this request. - IPAddress *string `json:"ipAddress,omitempty"` - // BackendResponseCode - The HTTP status code received by the gateway as a result of forwarding this request to the backend. - BackendResponseCode *string `json:"backendResponseCode,omitempty"` - // ResponseCode - The HTTP status code returned by the gateway. - ResponseCode *int32 `json:"responseCode,omitempty"` - // ResponseSize - The size of the response returned by the gateway. - ResponseSize *int32 `json:"responseSize,omitempty"` - // Timestamp - The date and time when this request was received by the gateway in ISO 8601 format. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Cache - Specifies if response cache was involved in generating the response. If the value is none, the cache was not used. If the value is hit, cached response was returned. If the value is miss, the cache was used but lookup resulted in a miss and request was fulfilled by the backend. - Cache *string `json:"cache,omitempty"` - // APITime - The total time it took to process this request. - APITime *float64 `json:"apiTime,omitempty"` - // ServiceTime - he time it took to forward this request to the backend and get the response back. - ServiceTime *float64 `json:"serviceTime,omitempty"` - // APIRegion - Azure region where the gateway that processed this request is located. - APIRegion *string `json:"apiRegion,omitempty"` - // SubscriptionID - Subscription identifier path. /subscriptions/{subscriptionId} - SubscriptionID *string `json:"subscriptionId,omitempty"` - // RequestID - Request Identifier. - RequestID *string `json:"requestId,omitempty"` - // RequestSize - The size of this request.. - RequestSize *int32 `json:"requestSize,omitempty"` -} - -// MarshalJSON is the custom marshaler for RequestReportRecordContract. -func (rrrc RequestReportRecordContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rrrc.APIID != nil { - objectMap["apiId"] = rrrc.APIID - } - if rrrc.OperationID != nil { - objectMap["operationId"] = rrrc.OperationID - } - if rrrc.Method != nil { - objectMap["method"] = rrrc.Method - } - if rrrc.URL != nil { - objectMap["url"] = rrrc.URL - } - if rrrc.IPAddress != nil { - objectMap["ipAddress"] = rrrc.IPAddress - } - if rrrc.BackendResponseCode != nil { - objectMap["backendResponseCode"] = rrrc.BackendResponseCode - } - if rrrc.ResponseCode != nil { - objectMap["responseCode"] = rrrc.ResponseCode - } - if rrrc.ResponseSize != nil { - objectMap["responseSize"] = rrrc.ResponseSize - } - if rrrc.Timestamp != nil { - objectMap["timestamp"] = rrrc.Timestamp - } - if rrrc.Cache != nil { - objectMap["cache"] = rrrc.Cache - } - if rrrc.APITime != nil { - objectMap["apiTime"] = rrrc.APITime - } - if rrrc.ServiceTime != nil { - objectMap["serviceTime"] = rrrc.ServiceTime - } - if rrrc.APIRegion != nil { - objectMap["apiRegion"] = rrrc.APIRegion - } - if rrrc.SubscriptionID != nil { - objectMap["subscriptionId"] = rrrc.SubscriptionID - } - if rrrc.RequestID != nil { - objectMap["requestId"] = rrrc.RequestID - } - if rrrc.RequestSize != nil { - objectMap["requestSize"] = rrrc.RequestSize - } - return json.Marshal(objectMap) -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceLocationDataContract resource location data properties. -type ResourceLocationDataContract struct { - // Name - A canonical name for the geographic or physical location. - Name *string `json:"name,omitempty"` - // City - The city or locality where the resource is located. - City *string `json:"city,omitempty"` - // District - The district, state, or province where the resource is located. - District *string `json:"district,omitempty"` - // CountryOrRegion - The country or region where the resource is located. - CountryOrRegion *string `json:"countryOrRegion,omitempty"` -} - -// ResourceSku describes an available API Management SKU. -type ResourceSku struct { - // Name - Name of the Sku. Possible values include: 'SkuTypeDeveloper', 'SkuTypeStandard', 'SkuTypePremium', 'SkuTypeBasic', 'SkuTypeConsumption', 'SkuTypeIsolated' - Name SkuType `json:"name,omitempty"` -} - -// ResourceSkuCapacity describes scaling information of a SKU. -type ResourceSkuCapacity struct { - // Minimum - READ-ONLY; The minimum capacity. - Minimum *int32 `json:"minimum,omitempty"` - // Maximum - READ-ONLY; The maximum capacity that can be set. - Maximum *int32 `json:"maximum,omitempty"` - // Default - READ-ONLY; The default capacity. - Default *int32 `json:"default,omitempty"` - // ScaleType - READ-ONLY; The scale type applicable to the sku. Possible values include: 'ResourceSkuCapacityScaleTypeAutomatic', 'ResourceSkuCapacityScaleTypeManual', 'ResourceSkuCapacityScaleTypeNone' - ScaleType ResourceSkuCapacityScaleType `json:"scaleType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceSkuCapacity. -func (rsc ResourceSkuCapacity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceSkuResult describes an available API Management service SKU. -type ResourceSkuResult struct { - // ResourceType - READ-ONLY; The type of resource the SKU applies to. - ResourceType *string `json:"resourceType,omitempty"` - // Sku - READ-ONLY; Specifies API Management SKU. - Sku *ResourceSku `json:"sku,omitempty"` - // Capacity - READ-ONLY; Specifies the number of API Management units. - Capacity *ResourceSkuCapacity `json:"capacity,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceSkuResult. -func (rsr ResourceSkuResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceSkuResults the API Management service SKUs operation response. -type ResourceSkuResults struct { - autorest.Response `json:"-"` - // Value - The list of skus available for the service. - Value *[]ResourceSkuResult `json:"value,omitempty"` - // NextLink - The uri to fetch the next page of API Management service Skus. - NextLink *string `json:"nextLink,omitempty"` -} - -// ResourceSkuResultsIterator provides access to a complete listing of ResourceSkuResult values. -type ResourceSkuResultsIterator struct { - i int - page ResourceSkuResultsPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ResourceSkuResultsIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuResultsIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ResourceSkuResultsIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ResourceSkuResultsIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ResourceSkuResultsIterator) Response() ResourceSkuResults { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ResourceSkuResultsIterator) Value() ResourceSkuResult { - if !iter.page.NotDone() { - return ResourceSkuResult{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ResourceSkuResultsIterator type. -func NewResourceSkuResultsIterator(page ResourceSkuResultsPage) ResourceSkuResultsIterator { - return ResourceSkuResultsIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rsr ResourceSkuResults) IsEmpty() bool { - return rsr.Value == nil || len(*rsr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rsr ResourceSkuResults) hasNextLink() bool { - return rsr.NextLink != nil && len(*rsr.NextLink) != 0 -} - -// resourceSkuResultsPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rsr ResourceSkuResults) resourceSkuResultsPreparer(ctx context.Context) (*http.Request, error) { - if !rsr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rsr.NextLink))) -} - -// ResourceSkuResultsPage contains a page of ResourceSkuResult values. -type ResourceSkuResultsPage struct { - fn func(context.Context, ResourceSkuResults) (ResourceSkuResults, error) - rsr ResourceSkuResults -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ResourceSkuResultsPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuResultsPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rsr) - if err != nil { - return err - } - page.rsr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ResourceSkuResultsPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ResourceSkuResultsPage) NotDone() bool { - return !page.rsr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ResourceSkuResultsPage) Response() ResourceSkuResults { - return page.rsr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ResourceSkuResultsPage) Values() []ResourceSkuResult { - if page.rsr.IsEmpty() { - return nil - } - return *page.rsr.Value -} - -// Creates a new instance of the ResourceSkuResultsPage type. -func NewResourceSkuResultsPage(cur ResourceSkuResults, getNextPage func(context.Context, ResourceSkuResults) (ResourceSkuResults, error)) ResourceSkuResultsPage { - return ResourceSkuResultsPage{ - fn: getNextPage, - rsr: cur, - } -} - -// ResponseContract operation response details. -type ResponseContract struct { - // StatusCode - Operation response HTTP status code. - StatusCode *int32 `json:"statusCode,omitempty"` - // Description - Operation response description. - Description *string `json:"description,omitempty"` - // Representations - Collection of operation response representations. - Representations *[]RepresentationContract `json:"representations,omitempty"` - // Headers - Collection of operation response headers. - Headers *[]ParameterContract `json:"headers,omitempty"` -} - -// SamplingSettings sampling settings for Diagnostic. -type SamplingSettings struct { - // SamplingType - Sampling type. Possible values include: 'SamplingTypeFixed' - SamplingType SamplingType `json:"samplingType,omitempty"` - // Percentage - Rate of sampling for fixed-rate sampling. - Percentage *float64 `json:"percentage,omitempty"` -} - -// SaveConfigurationParameter save Tenant Configuration Contract details. -type SaveConfigurationParameter struct { - // SaveConfigurationParameterProperties - Properties of the Save Configuration Parameters. - *SaveConfigurationParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SaveConfigurationParameter. -func (scp SaveConfigurationParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.SaveConfigurationParameterProperties != nil { - objectMap["properties"] = scp.SaveConfigurationParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SaveConfigurationParameter struct. -func (scp *SaveConfigurationParameter) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var saveConfigurationParameterProperties SaveConfigurationParameterProperties - err = json.Unmarshal(*v, &saveConfigurationParameterProperties) - if err != nil { - return err - } - scp.SaveConfigurationParameterProperties = &saveConfigurationParameterProperties - } - } - } - - return nil -} - -// SaveConfigurationParameterProperties parameters supplied to the Save Tenant Configuration operation. -type SaveConfigurationParameterProperties struct { - // Branch - The name of the Git branch in which to commit the current configuration snapshot. - Branch *string `json:"branch,omitempty"` - // Force - The value if true, the current configuration database is committed to the Git repository, even if the Git repository has newer changes that would be overwritten. - Force *bool `json:"force,omitempty"` -} - -// SchemaCollection the response of the list schema operation. -type SchemaCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; API Schema Contract value. - Value *[]SchemaContract `json:"value,omitempty"` - // Count - Total record count number. - Count *int64 `json:"count,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SchemaCollection. -func (sc SchemaCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sc.Count != nil { - objectMap["count"] = sc.Count - } - return json.Marshal(objectMap) -} - -// SchemaCollectionIterator provides access to a complete listing of SchemaContract values. -type SchemaCollectionIterator struct { - i int - page SchemaCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SchemaCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SchemaCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SchemaCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SchemaCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SchemaCollectionIterator) Response() SchemaCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SchemaCollectionIterator) Value() SchemaContract { - if !iter.page.NotDone() { - return SchemaContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SchemaCollectionIterator type. -func NewSchemaCollectionIterator(page SchemaCollectionPage) SchemaCollectionIterator { - return SchemaCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sc SchemaCollection) IsEmpty() bool { - return sc.Value == nil || len(*sc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sc SchemaCollection) hasNextLink() bool { - return sc.NextLink != nil && len(*sc.NextLink) != 0 -} - -// schemaCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sc SchemaCollection) schemaCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !sc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sc.NextLink))) -} - -// SchemaCollectionPage contains a page of SchemaContract values. -type SchemaCollectionPage struct { - fn func(context.Context, SchemaCollection) (SchemaCollection, error) - sc SchemaCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SchemaCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SchemaCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sc) - if err != nil { - return err - } - page.sc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SchemaCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SchemaCollectionPage) NotDone() bool { - return !page.sc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SchemaCollectionPage) Response() SchemaCollection { - return page.sc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SchemaCollectionPage) Values() []SchemaContract { - if page.sc.IsEmpty() { - return nil - } - return *page.sc.Value -} - -// Creates a new instance of the SchemaCollectionPage type. -func NewSchemaCollectionPage(cur SchemaCollection, getNextPage func(context.Context, SchemaCollection) (SchemaCollection, error)) SchemaCollectionPage { - return SchemaCollectionPage{ - fn: getNextPage, - sc: cur, - } -} - -// SchemaContract schema Contract details. -type SchemaContract struct { - autorest.Response `json:"-"` - // SchemaContractProperties - Properties of the Schema. - *SchemaContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SchemaContract. -func (sc SchemaContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sc.SchemaContractProperties != nil { - objectMap["properties"] = sc.SchemaContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SchemaContract struct. -func (sc *SchemaContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var schemaContractProperties SchemaContractProperties - err = json.Unmarshal(*v, &schemaContractProperties) - if err != nil { - return err - } - sc.SchemaContractProperties = &schemaContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sc.Type = &typeVar - } - } - } - - return nil -} - -// SchemaContractProperties API Schema create or update contract Properties. -type SchemaContractProperties struct { - // ContentType - Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml).
- `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json`
- `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml`
- `OpenApi` Schema use `application/vnd.oai.openapi.components+json`
- `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`. - ContentType *string `json:"contentType,omitempty"` - // SchemaDocumentProperties - Create or update Properties of the Schema Document. - *SchemaDocumentProperties `json:"document,omitempty"` -} - -// MarshalJSON is the custom marshaler for SchemaContractProperties. -func (scp SchemaContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.ContentType != nil { - objectMap["contentType"] = scp.ContentType - } - if scp.SchemaDocumentProperties != nil { - objectMap["document"] = scp.SchemaDocumentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SchemaContractProperties struct. -func (scp *SchemaContractProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "contentType": - if v != nil { - var contentType string - err = json.Unmarshal(*v, &contentType) - if err != nil { - return err - } - scp.ContentType = &contentType - } - case "document": - if v != nil { - var schemaDocumentProperties SchemaDocumentProperties - err = json.Unmarshal(*v, &schemaDocumentProperties) - if err != nil { - return err - } - scp.SchemaDocumentProperties = &schemaDocumentProperties - } - } - } - - return nil -} - -// SchemaDocumentProperties schema Document Properties. -type SchemaDocumentProperties struct { - // Value - Json escaped string defining the document representing the Schema. Used for schemas other than Swagger/OpenAPI. - Value *string `json:"value,omitempty"` - // Definitions - Types definitions. Used for OpenAPI v2 (Swagger) schemas only, null otherwise. - Definitions interface{} `json:"definitions,omitempty"` - // Components - Types definitions. Used for OpenAPI v3 schemas only, null otherwise. - Components interface{} `json:"components,omitempty"` -} - -// ServiceApplyNetworkConfigurationParameters parameter supplied to the Apply Network configuration -// operation. -type ServiceApplyNetworkConfigurationParameters struct { - // Location - Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. - Location *string `json:"location,omitempty"` -} - -// ServiceApplyNetworkConfigurationUpdatesFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ServiceApplyNetworkConfigurationUpdatesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceApplyNetworkConfigurationUpdatesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceApplyNetworkConfigurationUpdatesFuture.Result. -func (future *ServiceApplyNetworkConfigurationUpdatesFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceApplyNetworkConfigurationUpdatesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceApplyNetworkConfigurationUpdatesFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.ApplyNetworkConfigurationUpdatesResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceApplyNetworkConfigurationUpdatesFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceBackupFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceBackupFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceBackupFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceBackupFuture.Result. -func (future *ServiceBackupFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceBackupFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceBackupFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.BackupResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceBackupFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceBackupRestoreParameters parameters supplied to the Backup/Restore of an API Management service -// operation. -type ServiceBackupRestoreParameters struct { - // StorageAccount - The name of the Azure storage account (used to place/retrieve the backup). - StorageAccount *string `json:"storageAccount,omitempty"` - // ContainerName - The name of the blob container (used to place/retrieve the backup). - ContainerName *string `json:"containerName,omitempty"` - // BackupName - The name of the backup file to create/retrieve. - BackupName *string `json:"backupName,omitempty"` - // AccessType - The type of access to be used for the storage account. Possible values include: 'AccessTypeAccessKey', 'AccessTypeSystemAssignedManagedIdentity', 'AccessTypeUserAssignedManagedIdentity' - AccessType AccessType `json:"accessType,omitempty"` - // AccessKey - Storage account access key. Required only if `accessType` is set to `AccessKey`. - AccessKey *string `json:"accessKey,omitempty"` - // ClientID - The Client ID of user assigned managed identity. Required only if `accessType` is set to `UserAssignedManagedIdentity`. - ClientID *string `json:"clientId,omitempty"` -} - -// ServiceBaseProperties base Properties of an API Management service resource description. -type ServiceBaseProperties struct { - // NotificationSenderEmail - Email address from which the notification will be sent. - NotificationSenderEmail *string `json:"notificationSenderEmail,omitempty"` - // ProvisioningState - READ-ONLY; The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. - ProvisioningState *string `json:"provisioningState,omitempty"` - // TargetProvisioningState - READ-ONLY; The provisioning state of the API Management service, which is targeted by the long running operation started on the service. - TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` - // CreatedAtUtc - READ-ONLY; Creation UTC date of the API Management service.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - CreatedAtUtc *date.Time `json:"createdAtUtc,omitempty"` - // GatewayURL - READ-ONLY; Gateway URL of the API Management service. - GatewayURL *string `json:"gatewayUrl,omitempty"` - // GatewayRegionalURL - READ-ONLY; Gateway URL of the API Management service in the Default Region. - GatewayRegionalURL *string `json:"gatewayRegionalUrl,omitempty"` - // PortalURL - READ-ONLY; Publisher portal endpoint Url of the API Management service. - PortalURL *string `json:"portalUrl,omitempty"` - // ManagementAPIURL - READ-ONLY; Management API endpoint URL of the API Management service. - ManagementAPIURL *string `json:"managementApiUrl,omitempty"` - // ScmURL - READ-ONLY; SCM endpoint URL of the API Management service. - ScmURL *string `json:"scmUrl,omitempty"` - // DeveloperPortalURL - READ-ONLY; DEveloper Portal endpoint URL of the API Management service. - DeveloperPortalURL *string `json:"developerPortalUrl,omitempty"` - // HostnameConfigurations - Custom hostname configuration of the API Management service. - HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` - // PublicIPAddresses - READ-ONLY; Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard, Premium and Isolated SKU. - PublicIPAddresses *[]string `json:"publicIPAddresses,omitempty"` - // PrivateIPAddresses - READ-ONLY; Private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. - PrivateIPAddresses *[]string `json:"privateIPAddresses,omitempty"` - // PublicIPAddressID - Public Standard SKU IP V4 based IP address to be associated with Virtual Network deployed service in the region. Supported only for Developer and Premium SKU being deployed in Virtual Network. - PublicIPAddressID *string `json:"publicIpAddressId,omitempty"` - // PublicNetworkAccess - Whether or not public endpoint access is allowed for this API Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // VirtualNetworkConfiguration - Virtual network configuration of the API Management service. - VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` - // AdditionalLocations - Additional datacenter locations of the API Management service. - AdditionalLocations *[]AdditionalLocation `json:"additionalLocations,omitempty"` - // CustomProperties - Custom properties of the API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.

You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384 - CustomProperties map[string]*string `json:"customProperties"` - // Certificates - List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - Certificates *[]CertificateConfiguration `json:"certificates,omitempty"` - // EnableClientCertificate - Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - EnableClientCertificate *bool `json:"enableClientCertificate,omitempty"` - // DisableGateway - Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - DisableGateway *bool `json:"disableGateway,omitempty"` - // VirtualNetworkType - The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'VirtualNetworkTypeNone', 'VirtualNetworkTypeExternal', 'VirtualNetworkTypeInternal' - VirtualNetworkType VirtualNetworkType `json:"virtualNetworkType,omitempty"` - // APIVersionConstraint - Control Plane Apis version constraint for the API Management service. - APIVersionConstraint *APIVersionConstraint `json:"apiVersionConstraint,omitempty"` - // Restore - Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. - Restore *bool `json:"restore,omitempty"` - // PrivateEndpointConnections - List of Private Endpoint Connections of this service. - PrivateEndpointConnections *[]RemotePrivateEndpointConnectionWrapper `json:"privateEndpointConnections,omitempty"` - // PlatformVersion - READ-ONLY; Compute Platform Version running the service in this location. Possible values include: 'PlatformVersionUndetermined', 'PlatformVersionStv1', 'PlatformVersionStv2', 'PlatformVersionMtv1' - PlatformVersion PlatformVersion `json:"platformVersion,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceBaseProperties. -func (sbp ServiceBaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sbp.NotificationSenderEmail != nil { - objectMap["notificationSenderEmail"] = sbp.NotificationSenderEmail - } - if sbp.HostnameConfigurations != nil { - objectMap["hostnameConfigurations"] = sbp.HostnameConfigurations - } - if sbp.PublicIPAddressID != nil { - objectMap["publicIpAddressId"] = sbp.PublicIPAddressID - } - if sbp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = sbp.PublicNetworkAccess - } - if sbp.VirtualNetworkConfiguration != nil { - objectMap["virtualNetworkConfiguration"] = sbp.VirtualNetworkConfiguration - } - if sbp.AdditionalLocations != nil { - objectMap["additionalLocations"] = sbp.AdditionalLocations - } - if sbp.CustomProperties != nil { - objectMap["customProperties"] = sbp.CustomProperties - } - if sbp.Certificates != nil { - objectMap["certificates"] = sbp.Certificates - } - if sbp.EnableClientCertificate != nil { - objectMap["enableClientCertificate"] = sbp.EnableClientCertificate - } - if sbp.DisableGateway != nil { - objectMap["disableGateway"] = sbp.DisableGateway - } - if sbp.VirtualNetworkType != "" { - objectMap["virtualNetworkType"] = sbp.VirtualNetworkType - } - if sbp.APIVersionConstraint != nil { - objectMap["apiVersionConstraint"] = sbp.APIVersionConstraint - } - if sbp.Restore != nil { - objectMap["restore"] = sbp.Restore - } - if sbp.PrivateEndpointConnections != nil { - objectMap["privateEndpointConnections"] = sbp.PrivateEndpointConnections - } - return json.Marshal(objectMap) -} - -// ServiceCheckNameAvailabilityParameters parameters supplied to the CheckNameAvailability operation. -type ServiceCheckNameAvailabilityParameters struct { - // Name - The name to check for availability. - Name *string `json:"name,omitempty"` -} - -// ServiceCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceCreateOrUpdateFuture.Result. -func (future *ServiceCreateOrUpdateFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.CreateOrUpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceDeleteFuture.Result. -func (future *ServiceDeleteFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.DeleteResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceDeleteFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceGetDomainOwnershipIdentifierResult response of the GetDomainOwnershipIdentifier operation. -type ServiceGetDomainOwnershipIdentifierResult struct { - autorest.Response `json:"-"` - // DomainOwnershipIdentifier - READ-ONLY; The domain ownership identifier value. - DomainOwnershipIdentifier *string `json:"domainOwnershipIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceGetDomainOwnershipIdentifierResult. -func (sgdoir ServiceGetDomainOwnershipIdentifierResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServiceGetSsoTokenResult the response of the GetSsoToken operation. -type ServiceGetSsoTokenResult struct { - autorest.Response `json:"-"` - // RedirectURI - Redirect URL to the Publisher Portal containing the SSO token. - RedirectURI *string `json:"redirectUri,omitempty"` -} - -// ServiceIdentity identity properties of the Api Management service resource. -type ServiceIdentity struct { - // Type - The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. Possible values include: 'ApimIdentityTypeSystemAssigned', 'ApimIdentityTypeUserAssigned', 'ApimIdentityTypeSystemAssignedUserAssigned', 'ApimIdentityTypeNone' - Type ApimIdentityType `json:"type,omitempty"` - // PrincipalID - READ-ONLY; The principal id of the identity. - PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The client tenant id of the identity. - TenantID *uuid.UUID `json:"tenantId,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the resource. The user identity - // dictionary key references will be ARM resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ - // providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*UserIdentityProperties `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for ServiceIdentity. -func (si ServiceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if si.Type != "" { - objectMap["type"] = si.Type - } - if si.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = si.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// ServiceListResult the response of the List API Management services operation. -type ServiceListResult struct { - autorest.Response `json:"-"` - // Value - Result of the List API Management services operation. - Value *[]ServiceResource `json:"value,omitempty"` - // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of API Management services. - NextLink *string `json:"nextLink,omitempty"` -} - -// ServiceListResultIterator provides access to a complete listing of ServiceResource values. -type ServiceListResultIterator struct { - i int - page ServiceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServiceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServiceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServiceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServiceListResultIterator) Response() ServiceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServiceListResultIterator) Value() ServiceResource { - if !iter.page.NotDone() { - return ServiceResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServiceListResultIterator type. -func NewServiceListResultIterator(page ServiceListResultPage) ServiceListResultIterator { - return ServiceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (slr ServiceListResult) IsEmpty() bool { - return slr.Value == nil || len(*slr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (slr ServiceListResult) hasNextLink() bool { - return slr.NextLink != nil && len(*slr.NextLink) != 0 -} - -// serviceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (slr ServiceListResult) serviceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !slr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(slr.NextLink))) -} - -// ServiceListResultPage contains a page of ServiceResource values. -type ServiceListResultPage struct { - fn func(context.Context, ServiceListResult) (ServiceListResult, error) - slr ServiceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServiceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.slr) - if err != nil { - return err - } - page.slr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServiceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServiceListResultPage) NotDone() bool { - return !page.slr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServiceListResultPage) Response() ServiceListResult { - return page.slr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServiceListResultPage) Values() []ServiceResource { - if page.slr.IsEmpty() { - return nil - } - return *page.slr.Value -} - -// Creates a new instance of the ServiceListResultPage type. -func NewServiceListResultPage(cur ServiceListResult, getNextPage func(context.Context, ServiceListResult) (ServiceListResult, error)) ServiceListResultPage { - return ServiceListResultPage{ - fn: getNextPage, - slr: cur, - } -} - -// ServiceNameAvailabilityResult response of the CheckNameAvailability operation. -type ServiceNameAvailabilityResult struct { - autorest.Response `json:"-"` - // NameAvailable - READ-ONLY; True if the name is available and can be used to create a new API Management service; otherwise false. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Message - READ-ONLY; If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that is already in use, and direct them to select a different name. - Message *string `json:"message,omitempty"` - // Reason - Invalid indicates the name provided does not match the resource provider’s naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is already in use and is therefore unavailable. Possible values include: 'NameAvailabilityReasonValid', 'NameAvailabilityReasonInvalid', 'NameAvailabilityReasonAlreadyExists' - Reason NameAvailabilityReason `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceNameAvailabilityResult. -func (snar ServiceNameAvailabilityResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if snar.Reason != "" { - objectMap["reason"] = snar.Reason - } - return json.Marshal(objectMap) -} - -// ServiceProperties properties of an API Management service resource description. -type ServiceProperties struct { - // PublisherEmail - Publisher email. - PublisherEmail *string `json:"publisherEmail,omitempty"` - // PublisherName - Publisher name. - PublisherName *string `json:"publisherName,omitempty"` - // NotificationSenderEmail - Email address from which the notification will be sent. - NotificationSenderEmail *string `json:"notificationSenderEmail,omitempty"` - // ProvisioningState - READ-ONLY; The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. - ProvisioningState *string `json:"provisioningState,omitempty"` - // TargetProvisioningState - READ-ONLY; The provisioning state of the API Management service, which is targeted by the long running operation started on the service. - TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` - // CreatedAtUtc - READ-ONLY; Creation UTC date of the API Management service.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - CreatedAtUtc *date.Time `json:"createdAtUtc,omitempty"` - // GatewayURL - READ-ONLY; Gateway URL of the API Management service. - GatewayURL *string `json:"gatewayUrl,omitempty"` - // GatewayRegionalURL - READ-ONLY; Gateway URL of the API Management service in the Default Region. - GatewayRegionalURL *string `json:"gatewayRegionalUrl,omitempty"` - // PortalURL - READ-ONLY; Publisher portal endpoint Url of the API Management service. - PortalURL *string `json:"portalUrl,omitempty"` - // ManagementAPIURL - READ-ONLY; Management API endpoint URL of the API Management service. - ManagementAPIURL *string `json:"managementApiUrl,omitempty"` - // ScmURL - READ-ONLY; SCM endpoint URL of the API Management service. - ScmURL *string `json:"scmUrl,omitempty"` - // DeveloperPortalURL - READ-ONLY; DEveloper Portal endpoint URL of the API Management service. - DeveloperPortalURL *string `json:"developerPortalUrl,omitempty"` - // HostnameConfigurations - Custom hostname configuration of the API Management service. - HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` - // PublicIPAddresses - READ-ONLY; Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard, Premium and Isolated SKU. - PublicIPAddresses *[]string `json:"publicIPAddresses,omitempty"` - // PrivateIPAddresses - READ-ONLY; Private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. - PrivateIPAddresses *[]string `json:"privateIPAddresses,omitempty"` - // PublicIPAddressID - Public Standard SKU IP V4 based IP address to be associated with Virtual Network deployed service in the region. Supported only for Developer and Premium SKU being deployed in Virtual Network. - PublicIPAddressID *string `json:"publicIpAddressId,omitempty"` - // PublicNetworkAccess - Whether or not public endpoint access is allowed for this API Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // VirtualNetworkConfiguration - Virtual network configuration of the API Management service. - VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` - // AdditionalLocations - Additional datacenter locations of the API Management service. - AdditionalLocations *[]AdditionalLocation `json:"additionalLocations,omitempty"` - // CustomProperties - Custom properties of the API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.

You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384 - CustomProperties map[string]*string `json:"customProperties"` - // Certificates - List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - Certificates *[]CertificateConfiguration `json:"certificates,omitempty"` - // EnableClientCertificate - Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - EnableClientCertificate *bool `json:"enableClientCertificate,omitempty"` - // DisableGateway - Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - DisableGateway *bool `json:"disableGateway,omitempty"` - // VirtualNetworkType - The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'VirtualNetworkTypeNone', 'VirtualNetworkTypeExternal', 'VirtualNetworkTypeInternal' - VirtualNetworkType VirtualNetworkType `json:"virtualNetworkType,omitempty"` - // APIVersionConstraint - Control Plane Apis version constraint for the API Management service. - APIVersionConstraint *APIVersionConstraint `json:"apiVersionConstraint,omitempty"` - // Restore - Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. - Restore *bool `json:"restore,omitempty"` - // PrivateEndpointConnections - List of Private Endpoint Connections of this service. - PrivateEndpointConnections *[]RemotePrivateEndpointConnectionWrapper `json:"privateEndpointConnections,omitempty"` - // PlatformVersion - READ-ONLY; Compute Platform Version running the service in this location. Possible values include: 'PlatformVersionUndetermined', 'PlatformVersionStv1', 'PlatformVersionStv2', 'PlatformVersionMtv1' - PlatformVersion PlatformVersion `json:"platformVersion,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceProperties. -func (sp ServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.PublisherEmail != nil { - objectMap["publisherEmail"] = sp.PublisherEmail - } - if sp.PublisherName != nil { - objectMap["publisherName"] = sp.PublisherName - } - if sp.NotificationSenderEmail != nil { - objectMap["notificationSenderEmail"] = sp.NotificationSenderEmail - } - if sp.HostnameConfigurations != nil { - objectMap["hostnameConfigurations"] = sp.HostnameConfigurations - } - if sp.PublicIPAddressID != nil { - objectMap["publicIpAddressId"] = sp.PublicIPAddressID - } - if sp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = sp.PublicNetworkAccess - } - if sp.VirtualNetworkConfiguration != nil { - objectMap["virtualNetworkConfiguration"] = sp.VirtualNetworkConfiguration - } - if sp.AdditionalLocations != nil { - objectMap["additionalLocations"] = sp.AdditionalLocations - } - if sp.CustomProperties != nil { - objectMap["customProperties"] = sp.CustomProperties - } - if sp.Certificates != nil { - objectMap["certificates"] = sp.Certificates - } - if sp.EnableClientCertificate != nil { - objectMap["enableClientCertificate"] = sp.EnableClientCertificate - } - if sp.DisableGateway != nil { - objectMap["disableGateway"] = sp.DisableGateway - } - if sp.VirtualNetworkType != "" { - objectMap["virtualNetworkType"] = sp.VirtualNetworkType - } - if sp.APIVersionConstraint != nil { - objectMap["apiVersionConstraint"] = sp.APIVersionConstraint - } - if sp.Restore != nil { - objectMap["restore"] = sp.Restore - } - if sp.PrivateEndpointConnections != nil { - objectMap["privateEndpointConnections"] = sp.PrivateEndpointConnections - } - return json.Marshal(objectMap) -} - -// ServiceResource a single API Management service resource in List or Get response. -type ServiceResource struct { - autorest.Response `json:"-"` - // ServiceProperties - Properties of the API Management service. - *ServiceProperties `json:"properties,omitempty"` - // Sku - SKU properties of the API Management service. - Sku *ServiceSkuProperties `json:"sku,omitempty"` - // Identity - Managed service identity of the Api Management service. - Identity *ServiceIdentity `json:"identity,omitempty"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Etag - READ-ONLY; ETag of the resource. - Etag *string `json:"etag,omitempty"` - // Zones - A list of availability zones denoting where the resource needs to come from. - Zones *[]string `json:"zones,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type for API Management resource is set to Microsoft.ApiManagement. - Type *string `json:"type,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServiceResource. -func (sr ServiceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.ServiceProperties != nil { - objectMap["properties"] = sr.ServiceProperties - } - if sr.Sku != nil { - objectMap["sku"] = sr.Sku - } - if sr.Identity != nil { - objectMap["identity"] = sr.Identity - } - if sr.Location != nil { - objectMap["location"] = sr.Location - } - if sr.Zones != nil { - objectMap["zones"] = sr.Zones - } - if sr.Tags != nil { - objectMap["tags"] = sr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceResource struct. -func (sr *ServiceResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var serviceProperties ServiceProperties - err = json.Unmarshal(*v, &serviceProperties) - if err != nil { - return err - } - sr.ServiceProperties = &serviceProperties - } - case "sku": - if v != nil { - var sku ServiceSkuProperties - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sr.Sku = &sku - } - case "identity": - if v != nil { - var identity ServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sr.Identity = &identity - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sr.SystemData = &systemData - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sr.Location = &location - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sr.Etag = &etag - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - sr.Zones = &zones - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sr.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sr.Tags = tags - } - } - } - - return nil -} - -// ServiceRestoreFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceRestoreFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceRestoreFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceRestoreFuture.Result. -func (future *ServiceRestoreFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceRestoreFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceRestoreFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.RestoreResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceRestoreFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceSkuProperties API Management service resource SKU properties. -type ServiceSkuProperties struct { - // Name - Name of the Sku. Possible values include: 'SkuTypeDeveloper', 'SkuTypeStandard', 'SkuTypePremium', 'SkuTypeBasic', 'SkuTypeConsumption', 'SkuTypeIsolated' - Name SkuType `json:"name,omitempty"` - // Capacity - Capacity of the SKU (number of deployed units of the SKU). For Consumption SKU capacity must be specified as 0. - Capacity *int32 `json:"capacity,omitempty"` -} - -// ServiceUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceUpdateFuture.Result. -func (future *ServiceUpdateFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.UpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceUpdateParameters parameter supplied to Update Api Management Service. -type ServiceUpdateParameters struct { - // ServiceUpdateProperties - Properties of the API Management service. - *ServiceUpdateProperties `json:"properties,omitempty"` - // Sku - SKU properties of the API Management service. - Sku *ServiceSkuProperties `json:"sku,omitempty"` - // Identity - Managed service identity of the Api Management service. - Identity *ServiceIdentity `json:"identity,omitempty"` - // Etag - READ-ONLY; ETag of the resource. - Etag *string `json:"etag,omitempty"` - // Zones - A list of availability zones denoting where the resource needs to come from. - Zones *[]string `json:"zones,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type for API Management resource is set to Microsoft.ApiManagement. - Type *string `json:"type,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServiceUpdateParameters. -func (sup ServiceUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.ServiceUpdateProperties != nil { - objectMap["properties"] = sup.ServiceUpdateProperties - } - if sup.Sku != nil { - objectMap["sku"] = sup.Sku - } - if sup.Identity != nil { - objectMap["identity"] = sup.Identity - } - if sup.Zones != nil { - objectMap["zones"] = sup.Zones - } - if sup.Tags != nil { - objectMap["tags"] = sup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceUpdateParameters struct. -func (sup *ServiceUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var serviceUpdateProperties ServiceUpdateProperties - err = json.Unmarshal(*v, &serviceUpdateProperties) - if err != nil { - return err - } - sup.ServiceUpdateProperties = &serviceUpdateProperties - } - case "sku": - if v != nil { - var sku ServiceSkuProperties - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sup.Sku = &sku - } - case "identity": - if v != nil { - var identity ServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sup.Identity = &identity - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sup.Etag = &etag - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - sup.Zones = &zones - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sup.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sup.Tags = tags - } - } - } - - return nil -} - -// ServiceUpdateProperties properties of an API Management service resource description. -type ServiceUpdateProperties struct { - // PublisherEmail - Publisher email. - PublisherEmail *string `json:"publisherEmail,omitempty"` - // PublisherName - Publisher name. - PublisherName *string `json:"publisherName,omitempty"` - // NotificationSenderEmail - Email address from which the notification will be sent. - NotificationSenderEmail *string `json:"notificationSenderEmail,omitempty"` - // ProvisioningState - READ-ONLY; The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. - ProvisioningState *string `json:"provisioningState,omitempty"` - // TargetProvisioningState - READ-ONLY; The provisioning state of the API Management service, which is targeted by the long running operation started on the service. - TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` - // CreatedAtUtc - READ-ONLY; Creation UTC date of the API Management service.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - CreatedAtUtc *date.Time `json:"createdAtUtc,omitempty"` - // GatewayURL - READ-ONLY; Gateway URL of the API Management service. - GatewayURL *string `json:"gatewayUrl,omitempty"` - // GatewayRegionalURL - READ-ONLY; Gateway URL of the API Management service in the Default Region. - GatewayRegionalURL *string `json:"gatewayRegionalUrl,omitempty"` - // PortalURL - READ-ONLY; Publisher portal endpoint Url of the API Management service. - PortalURL *string `json:"portalUrl,omitempty"` - // ManagementAPIURL - READ-ONLY; Management API endpoint URL of the API Management service. - ManagementAPIURL *string `json:"managementApiUrl,omitempty"` - // ScmURL - READ-ONLY; SCM endpoint URL of the API Management service. - ScmURL *string `json:"scmUrl,omitempty"` - // DeveloperPortalURL - READ-ONLY; DEveloper Portal endpoint URL of the API Management service. - DeveloperPortalURL *string `json:"developerPortalUrl,omitempty"` - // HostnameConfigurations - Custom hostname configuration of the API Management service. - HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` - // PublicIPAddresses - READ-ONLY; Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard, Premium and Isolated SKU. - PublicIPAddresses *[]string `json:"publicIPAddresses,omitempty"` - // PrivateIPAddresses - READ-ONLY; Private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. - PrivateIPAddresses *[]string `json:"privateIPAddresses,omitempty"` - // PublicIPAddressID - Public Standard SKU IP V4 based IP address to be associated with Virtual Network deployed service in the region. Supported only for Developer and Premium SKU being deployed in Virtual Network. - PublicIPAddressID *string `json:"publicIpAddressId,omitempty"` - // PublicNetworkAccess - Whether or not public endpoint access is allowed for this API Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // VirtualNetworkConfiguration - Virtual network configuration of the API Management service. - VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` - // AdditionalLocations - Additional datacenter locations of the API Management service. - AdditionalLocations *[]AdditionalLocation `json:"additionalLocations,omitempty"` - // CustomProperties - Custom properties of the API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.

You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384 - CustomProperties map[string]*string `json:"customProperties"` - // Certificates - List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - Certificates *[]CertificateConfiguration `json:"certificates,omitempty"` - // EnableClientCertificate - Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - EnableClientCertificate *bool `json:"enableClientCertificate,omitempty"` - // DisableGateway - Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - DisableGateway *bool `json:"disableGateway,omitempty"` - // VirtualNetworkType - The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'VirtualNetworkTypeNone', 'VirtualNetworkTypeExternal', 'VirtualNetworkTypeInternal' - VirtualNetworkType VirtualNetworkType `json:"virtualNetworkType,omitempty"` - // APIVersionConstraint - Control Plane Apis version constraint for the API Management service. - APIVersionConstraint *APIVersionConstraint `json:"apiVersionConstraint,omitempty"` - // Restore - Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. - Restore *bool `json:"restore,omitempty"` - // PrivateEndpointConnections - List of Private Endpoint Connections of this service. - PrivateEndpointConnections *[]RemotePrivateEndpointConnectionWrapper `json:"privateEndpointConnections,omitempty"` - // PlatformVersion - READ-ONLY; Compute Platform Version running the service in this location. Possible values include: 'PlatformVersionUndetermined', 'PlatformVersionStv1', 'PlatformVersionStv2', 'PlatformVersionMtv1' - PlatformVersion PlatformVersion `json:"platformVersion,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceUpdateProperties. -func (sup ServiceUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.PublisherEmail != nil { - objectMap["publisherEmail"] = sup.PublisherEmail - } - if sup.PublisherName != nil { - objectMap["publisherName"] = sup.PublisherName - } - if sup.NotificationSenderEmail != nil { - objectMap["notificationSenderEmail"] = sup.NotificationSenderEmail - } - if sup.HostnameConfigurations != nil { - objectMap["hostnameConfigurations"] = sup.HostnameConfigurations - } - if sup.PublicIPAddressID != nil { - objectMap["publicIpAddressId"] = sup.PublicIPAddressID - } - if sup.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = sup.PublicNetworkAccess - } - if sup.VirtualNetworkConfiguration != nil { - objectMap["virtualNetworkConfiguration"] = sup.VirtualNetworkConfiguration - } - if sup.AdditionalLocations != nil { - objectMap["additionalLocations"] = sup.AdditionalLocations - } - if sup.CustomProperties != nil { - objectMap["customProperties"] = sup.CustomProperties - } - if sup.Certificates != nil { - objectMap["certificates"] = sup.Certificates - } - if sup.EnableClientCertificate != nil { - objectMap["enableClientCertificate"] = sup.EnableClientCertificate - } - if sup.DisableGateway != nil { - objectMap["disableGateway"] = sup.DisableGateway - } - if sup.VirtualNetworkType != "" { - objectMap["virtualNetworkType"] = sup.VirtualNetworkType - } - if sup.APIVersionConstraint != nil { - objectMap["apiVersionConstraint"] = sup.APIVersionConstraint - } - if sup.Restore != nil { - objectMap["restore"] = sup.Restore - } - if sup.PrivateEndpointConnections != nil { - objectMap["privateEndpointConnections"] = sup.PrivateEndpointConnections - } - return json.Marshal(objectMap) -} - -// Sku describes an available ApiManagement SKU. -type Sku struct { - // ResourceType - READ-ONLY; The type of resource the SKU applies to. - ResourceType *string `json:"resourceType,omitempty"` - // Name - READ-ONLY; The name of SKU. - Name *string `json:"name,omitempty"` - // Tier - READ-ONLY; Specifies the tier of virtual machines in a scale set.

Possible Values:

**Standard**

**Basic** - Tier *string `json:"tier,omitempty"` - // Size - READ-ONLY; The Size of the SKU. - Size *string `json:"size,omitempty"` - // Family - READ-ONLY; The Family of this particular SKU. - Family *string `json:"family,omitempty"` - // Kind - READ-ONLY; The Kind of resources that are supported in this SKU. - Kind *string `json:"kind,omitempty"` - // Capacity - READ-ONLY; Specifies the number of virtual machines in the scale set. - Capacity *SkuCapacity `json:"capacity,omitempty"` - // Locations - READ-ONLY; The set of locations that the SKU is available. - Locations *[]string `json:"locations,omitempty"` - // LocationInfo - READ-ONLY; A list of locations and availability zones in those locations where the SKU is available. - LocationInfo *[]SkuLocationInfo `json:"locationInfo,omitempty"` - // APIVersions - READ-ONLY; The api versions that support this SKU. - APIVersions *[]string `json:"apiVersions,omitempty"` - // Costs - READ-ONLY; Metadata for retrieving price info. - Costs *[]SkuCosts `json:"costs,omitempty"` - // Capabilities - READ-ONLY; A name value pair to describe the capability. - Capabilities *[]SkuCapabilities `json:"capabilities,omitempty"` - // Restrictions - READ-ONLY; The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - Restrictions *[]SkuRestrictions `json:"restrictions,omitempty"` -} - -// MarshalJSON is the custom marshaler for Sku. -func (s Sku) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SkuCapabilities describes The SKU capabilities object. -type SkuCapabilities struct { - // Name - READ-ONLY; An invariant to describe the feature. - Name *string `json:"name,omitempty"` - // Value - READ-ONLY; An invariant if the feature is measured by quantity. - Value *string `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkuCapabilities. -func (sc SkuCapabilities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SkuCapacity describes scaling information of a SKU. -type SkuCapacity struct { - // Minimum - READ-ONLY; The minimum capacity. - Minimum *int32 `json:"minimum,omitempty"` - // Maximum - READ-ONLY; The maximum capacity that can be set. - Maximum *int32 `json:"maximum,omitempty"` - // Default - READ-ONLY; The default capacity. - Default *int32 `json:"default,omitempty"` - // ScaleType - READ-ONLY; The scale type applicable to the sku. Possible values include: 'SkuCapacityScaleTypeAutomatic', 'SkuCapacityScaleTypeManual', 'SkuCapacityScaleTypeNone' - ScaleType SkuCapacityScaleType `json:"scaleType,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkuCapacity. -func (sc SkuCapacity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SkuCosts describes metadata for retrieving price info. -type SkuCosts struct { - // MeterID - READ-ONLY; Used for querying price from commerce. - MeterID *string `json:"meterID,omitempty"` - // Quantity - READ-ONLY; The multiplier is needed to extend the base metered cost. - Quantity *int64 `json:"quantity,omitempty"` - // ExtendedUnit - READ-ONLY; An invariant to show the extended unit. - ExtendedUnit *string `json:"extendedUnit,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkuCosts. -func (sc SkuCosts) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SkuLocationInfo ... -type SkuLocationInfo struct { - // Location - READ-ONLY; Location of the SKU - Location *string `json:"location,omitempty"` - // Zones - READ-ONLY; List of availability zones where the SKU is supported. - Zones *[]string `json:"zones,omitempty"` - // ZoneDetails - READ-ONLY; Details of capabilities available to a SKU in specific zones. - ZoneDetails *[]SkuZoneDetails `json:"zoneDetails,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkuLocationInfo. -func (sli SkuLocationInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SkuRestrictionInfo ... -type SkuRestrictionInfo struct { - // Locations - READ-ONLY; Locations where the SKU is restricted - Locations *[]string `json:"locations,omitempty"` - // Zones - READ-ONLY; List of availability zones where the SKU is restricted. - Zones *[]string `json:"zones,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkuRestrictionInfo. -func (sri SkuRestrictionInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SkuRestrictions describes scaling information of a SKU. -type SkuRestrictions struct { - // Type - READ-ONLY; The type of restrictions. Possible values include: 'SkuRestrictionsTypeLocation', 'SkuRestrictionsTypeZone' - Type SkuRestrictionsType `json:"type,omitempty"` - // Values - READ-ONLY; The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. - Values *[]string `json:"values,omitempty"` - // RestrictionInfo - READ-ONLY; The information about the restriction where the SKU cannot be used. - RestrictionInfo *SkuRestrictionInfo `json:"restrictionInfo,omitempty"` - // ReasonCode - READ-ONLY; The reason for restriction. Possible values include: 'SkuRestrictionsReasonCodeQuotaID', 'SkuRestrictionsReasonCodeNotAvailableForSubscription' - ReasonCode SkuRestrictionsReasonCode `json:"reasonCode,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkuRestrictions. -func (sr SkuRestrictions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SkusResult the List Resource Skus operation response. -type SkusResult struct { - autorest.Response `json:"-"` - // Value - The list of skus available for the subscription. - Value *[]Sku `json:"value,omitempty"` - // NextLink - READ-ONLY; The URI to fetch the next page of Resource Skus. Call ListNext() with this URI to fetch the next page of Resource Skus - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkusResult. -func (sr SkusResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Value != nil { - objectMap["value"] = sr.Value - } - return json.Marshal(objectMap) -} - -// SkusResultIterator provides access to a complete listing of Sku values. -type SkusResultIterator struct { - i int - page SkusResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SkusResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SkusResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SkusResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SkusResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SkusResultIterator) Response() SkusResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SkusResultIterator) Value() Sku { - if !iter.page.NotDone() { - return Sku{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SkusResultIterator type. -func NewSkusResultIterator(page SkusResultPage) SkusResultIterator { - return SkusResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sr SkusResult) IsEmpty() bool { - return sr.Value == nil || len(*sr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sr SkusResult) hasNextLink() bool { - return sr.NextLink != nil && len(*sr.NextLink) != 0 -} - -// skusResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sr SkusResult) skusResultPreparer(ctx context.Context) (*http.Request, error) { - if !sr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sr.NextLink))) -} - -// SkusResultPage contains a page of Sku values. -type SkusResultPage struct { - fn func(context.Context, SkusResult) (SkusResult, error) - sr SkusResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SkusResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SkusResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sr) - if err != nil { - return err - } - page.sr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SkusResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SkusResultPage) NotDone() bool { - return !page.sr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SkusResultPage) Response() SkusResult { - return page.sr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SkusResultPage) Values() []Sku { - if page.sr.IsEmpty() { - return nil - } - return *page.sr.Value -} - -// Creates a new instance of the SkusResultPage type. -func NewSkusResultPage(cur SkusResult, getNextPage func(context.Context, SkusResult) (SkusResult, error)) SkusResultPage { - return SkusResultPage{ - fn: getNextPage, - sr: cur, - } -} - -// SkuZoneDetails describes The zonal capabilities of a SKU. -type SkuZoneDetails struct { - // Name - READ-ONLY; The set of zones that the SKU is available in with the specified capabilities. - Name *[]string `json:"name,omitempty"` - // Capabilities - READ-ONLY; A list of capabilities that are available for the SKU in the specified list of zones. - Capabilities *[]SkuCapabilities `json:"capabilities,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkuZoneDetails. -func (szd SkuZoneDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SubscriptionCollection paged Subscriptions list representation. -type SubscriptionCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]SubscriptionContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// SubscriptionCollectionIterator provides access to a complete listing of SubscriptionContract values. -type SubscriptionCollectionIterator struct { - i int - page SubscriptionCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SubscriptionCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SubscriptionCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SubscriptionCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SubscriptionCollectionIterator) Response() SubscriptionCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SubscriptionCollectionIterator) Value() SubscriptionContract { - if !iter.page.NotDone() { - return SubscriptionContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SubscriptionCollectionIterator type. -func NewSubscriptionCollectionIterator(page SubscriptionCollectionPage) SubscriptionCollectionIterator { - return SubscriptionCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sc SubscriptionCollection) IsEmpty() bool { - return sc.Value == nil || len(*sc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sc SubscriptionCollection) hasNextLink() bool { - return sc.NextLink != nil && len(*sc.NextLink) != 0 -} - -// subscriptionCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sc SubscriptionCollection) subscriptionCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !sc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sc.NextLink))) -} - -// SubscriptionCollectionPage contains a page of SubscriptionContract values. -type SubscriptionCollectionPage struct { - fn func(context.Context, SubscriptionCollection) (SubscriptionCollection, error) - sc SubscriptionCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SubscriptionCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sc) - if err != nil { - return err - } - page.sc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SubscriptionCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SubscriptionCollectionPage) NotDone() bool { - return !page.sc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SubscriptionCollectionPage) Response() SubscriptionCollection { - return page.sc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SubscriptionCollectionPage) Values() []SubscriptionContract { - if page.sc.IsEmpty() { - return nil - } - return *page.sc.Value -} - -// Creates a new instance of the SubscriptionCollectionPage type. -func NewSubscriptionCollectionPage(cur SubscriptionCollection, getNextPage func(context.Context, SubscriptionCollection) (SubscriptionCollection, error)) SubscriptionCollectionPage { - return SubscriptionCollectionPage{ - fn: getNextPage, - sc: cur, - } -} - -// SubscriptionContract subscription details. -type SubscriptionContract struct { - autorest.Response `json:"-"` - // SubscriptionContractProperties - Subscription contract properties. - *SubscriptionContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionContract. -func (sc SubscriptionContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sc.SubscriptionContractProperties != nil { - objectMap["properties"] = sc.SubscriptionContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubscriptionContract struct. -func (sc *SubscriptionContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var subscriptionContractProperties SubscriptionContractProperties - err = json.Unmarshal(*v, &subscriptionContractProperties) - if err != nil { - return err - } - sc.SubscriptionContractProperties = &subscriptionContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sc.Type = &typeVar - } - } - } - - return nil -} - -// SubscriptionContractProperties subscription details. -type SubscriptionContractProperties struct { - // OwnerID - The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier. - OwnerID *string `json:"ownerId,omitempty"` - // Scope - Scope like /products/{productId} or /apis or /apis/{apiId}. - Scope *string `json:"scope,omitempty"` - // DisplayName - The name of the subscription, or null if the subscription has no name. - DisplayName *string `json:"displayName,omitempty"` - // State - Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'SubscriptionStateSuspended', 'SubscriptionStateActive', 'SubscriptionStateExpired', 'SubscriptionStateSubmitted', 'SubscriptionStateRejected', 'SubscriptionStateCancelled' - State SubscriptionState `json:"state,omitempty"` - // CreatedDate - READ-ONLY; Subscription creation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // StartDate - Subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - StartDate *date.Time `json:"startDate,omitempty"` - // ExpirationDate - Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - // EndDate - Date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - EndDate *date.Time `json:"endDate,omitempty"` - // NotificationDate - Upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - NotificationDate *date.Time `json:"notificationDate,omitempty"` - // PrimaryKey - Subscription primary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Subscription secondary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // StateComment - Optional subscription comment added by an administrator when the state is changed to the 'rejected'. - StateComment *string `json:"stateComment,omitempty"` - // AllowTracing - Determines whether tracing is enabled - AllowTracing *bool `json:"allowTracing,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionContractProperties. -func (scp SubscriptionContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.OwnerID != nil { - objectMap["ownerId"] = scp.OwnerID - } - if scp.Scope != nil { - objectMap["scope"] = scp.Scope - } - if scp.DisplayName != nil { - objectMap["displayName"] = scp.DisplayName - } - if scp.State != "" { - objectMap["state"] = scp.State - } - if scp.StartDate != nil { - objectMap["startDate"] = scp.StartDate - } - if scp.ExpirationDate != nil { - objectMap["expirationDate"] = scp.ExpirationDate - } - if scp.EndDate != nil { - objectMap["endDate"] = scp.EndDate - } - if scp.NotificationDate != nil { - objectMap["notificationDate"] = scp.NotificationDate - } - if scp.PrimaryKey != nil { - objectMap["primaryKey"] = scp.PrimaryKey - } - if scp.SecondaryKey != nil { - objectMap["secondaryKey"] = scp.SecondaryKey - } - if scp.StateComment != nil { - objectMap["stateComment"] = scp.StateComment - } - if scp.AllowTracing != nil { - objectMap["allowTracing"] = scp.AllowTracing - } - return json.Marshal(objectMap) -} - -// SubscriptionCreateParameterProperties parameters supplied to the Create subscription operation. -type SubscriptionCreateParameterProperties struct { - // OwnerID - User (user id path) for whom subscription is being created in form /users/{userId} - OwnerID *string `json:"ownerId,omitempty"` - // Scope - Scope like /products/{productId} or /apis or /apis/{apiId}. - Scope *string `json:"scope,omitempty"` - // DisplayName - Subscription name. - DisplayName *string `json:"displayName,omitempty"` - // PrimaryKey - Primary subscription key. If not specified during request key will be generated automatically. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Secondary subscription key. If not specified during request key will be generated automatically. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // State - Initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'SubscriptionStateSuspended', 'SubscriptionStateActive', 'SubscriptionStateExpired', 'SubscriptionStateSubmitted', 'SubscriptionStateRejected', 'SubscriptionStateCancelled' - State SubscriptionState `json:"state,omitempty"` - // AllowTracing - Determines whether tracing can be enabled - AllowTracing *bool `json:"allowTracing,omitempty"` -} - -// SubscriptionCreateParameters subscription create details. -type SubscriptionCreateParameters struct { - // SubscriptionCreateParameterProperties - Subscription contract properties. - *SubscriptionCreateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionCreateParameters. -func (scp SubscriptionCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.SubscriptionCreateParameterProperties != nil { - objectMap["properties"] = scp.SubscriptionCreateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubscriptionCreateParameters struct. -func (scp *SubscriptionCreateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var subscriptionCreateParameterProperties SubscriptionCreateParameterProperties - err = json.Unmarshal(*v, &subscriptionCreateParameterProperties) - if err != nil { - return err - } - scp.SubscriptionCreateParameterProperties = &subscriptionCreateParameterProperties - } - } - } - - return nil -} - -// SubscriptionKeyParameterNamesContract subscription key parameter names details. -type SubscriptionKeyParameterNamesContract struct { - // Header - Subscription key header name. - Header *string `json:"header,omitempty"` - // Query - Subscription key query string parameter name. - Query *string `json:"query,omitempty"` -} - -// SubscriptionKeysContract subscription keys. -type SubscriptionKeysContract struct { - autorest.Response `json:"-"` - // PrimaryKey - Subscription primary key. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Subscription secondary key. - SecondaryKey *string `json:"secondaryKey,omitempty"` -} - -// SubscriptionsDelegationSettingsProperties subscriptions delegation settings properties. -type SubscriptionsDelegationSettingsProperties struct { - // Enabled - Enable or disable delegation for subscriptions. - Enabled *bool `json:"enabled,omitempty"` -} - -// SubscriptionUpdateParameterProperties parameters supplied to the Update subscription operation. -type SubscriptionUpdateParameterProperties struct { - // OwnerID - User identifier path: /users/{userId} - OwnerID *string `json:"ownerId,omitempty"` - // Scope - Scope like /products/{productId} or /apis or /apis/{apiId} - Scope *string `json:"scope,omitempty"` - // ExpirationDate - Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - // DisplayName - Subscription name. - DisplayName *string `json:"displayName,omitempty"` - // PrimaryKey - Primary subscription key. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Secondary subscription key. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // State - Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'SubscriptionStateSuspended', 'SubscriptionStateActive', 'SubscriptionStateExpired', 'SubscriptionStateSubmitted', 'SubscriptionStateRejected', 'SubscriptionStateCancelled' - State SubscriptionState `json:"state,omitempty"` - // StateComment - Comments describing subscription state change by the administrator when the state is changed to the 'rejected'. - StateComment *string `json:"stateComment,omitempty"` - // AllowTracing - Determines whether tracing can be enabled - AllowTracing *bool `json:"allowTracing,omitempty"` -} - -// SubscriptionUpdateParameters subscription update details. -type SubscriptionUpdateParameters struct { - // SubscriptionUpdateParameterProperties - Subscription Update contract properties. - *SubscriptionUpdateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionUpdateParameters. -func (sup SubscriptionUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.SubscriptionUpdateParameterProperties != nil { - objectMap["properties"] = sup.SubscriptionUpdateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubscriptionUpdateParameters struct. -func (sup *SubscriptionUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var subscriptionUpdateParameterProperties SubscriptionUpdateParameterProperties - err = json.Unmarshal(*v, &subscriptionUpdateParameterProperties) - if err != nil { - return err - } - sup.SubscriptionUpdateParameterProperties = &subscriptionUpdateParameterProperties - } - } - } - - return nil -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TagCollection paged Tag list representation. -type TagCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]TagContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// TagCollectionIterator provides access to a complete listing of TagContract values. -type TagCollectionIterator struct { - i int - page TagCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *TagCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *TagCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TagCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter TagCollectionIterator) Response() TagCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter TagCollectionIterator) Value() TagContract { - if !iter.page.NotDone() { - return TagContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TagCollectionIterator type. -func NewTagCollectionIterator(page TagCollectionPage) TagCollectionIterator { - return TagCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tc TagCollection) IsEmpty() bool { - return tc.Value == nil || len(*tc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tc TagCollection) hasNextLink() bool { - return tc.NextLink != nil && len(*tc.NextLink) != 0 -} - -// tagCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tc TagCollection) tagCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !tc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tc.NextLink))) -} - -// TagCollectionPage contains a page of TagContract values. -type TagCollectionPage struct { - fn func(context.Context, TagCollection) (TagCollection, error) - tc TagCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *TagCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.tc) - if err != nil { - return err - } - page.tc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *TagCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TagCollectionPage) NotDone() bool { - return !page.tc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TagCollectionPage) Response() TagCollection { - return page.tc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TagCollectionPage) Values() []TagContract { - if page.tc.IsEmpty() { - return nil - } - return *page.tc.Value -} - -// Creates a new instance of the TagCollectionPage type. -func NewTagCollectionPage(cur TagCollection, getNextPage func(context.Context, TagCollection) (TagCollection, error)) TagCollectionPage { - return TagCollectionPage{ - fn: getNextPage, - tc: cur, - } -} - -// TagContract tag Contract details. -type TagContract struct { - autorest.Response `json:"-"` - // TagContractProperties - Tag entity contract properties. - *TagContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagContract. -func (tc TagContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tc.TagContractProperties != nil { - objectMap["properties"] = tc.TagContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TagContract struct. -func (tc *TagContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var tagContractProperties TagContractProperties - err = json.Unmarshal(*v, &tagContractProperties) - if err != nil { - return err - } - tc.TagContractProperties = &tagContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tc.Type = &typeVar - } - } - } - - return nil -} - -// TagContractProperties tag contract Properties. -type TagContractProperties struct { - // DisplayName - Tag name. - DisplayName *string `json:"displayName,omitempty"` -} - -// TagCreateUpdateParameters parameters supplied to Create/Update Tag operations. -type TagCreateUpdateParameters struct { - // TagContractProperties - Properties supplied to Create Tag operation. - *TagContractProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagCreateUpdateParameters. -func (tcup TagCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tcup.TagContractProperties != nil { - objectMap["properties"] = tcup.TagContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TagCreateUpdateParameters struct. -func (tcup *TagCreateUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var tagContractProperties TagContractProperties - err = json.Unmarshal(*v, &tagContractProperties) - if err != nil { - return err - } - tcup.TagContractProperties = &tagContractProperties - } - } - } - - return nil -} - -// TagDescriptionBaseProperties parameters supplied to the Create TagDescription operation. -type TagDescriptionBaseProperties struct { - // Description - Description of the Tag. - Description *string `json:"description,omitempty"` - // ExternalDocsURL - Absolute URL of external resources describing the tag. - ExternalDocsURL *string `json:"externalDocsUrl,omitempty"` - // ExternalDocsDescription - Description of the external resources describing the tag. - ExternalDocsDescription *string `json:"externalDocsDescription,omitempty"` -} - -// TagDescriptionCollection paged TagDescription list representation. -type TagDescriptionCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]TagDescriptionContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// TagDescriptionCollectionIterator provides access to a complete listing of TagDescriptionContract values. -type TagDescriptionCollectionIterator struct { - i int - page TagDescriptionCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *TagDescriptionCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagDescriptionCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *TagDescriptionCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TagDescriptionCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter TagDescriptionCollectionIterator) Response() TagDescriptionCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter TagDescriptionCollectionIterator) Value() TagDescriptionContract { - if !iter.page.NotDone() { - return TagDescriptionContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TagDescriptionCollectionIterator type. -func NewTagDescriptionCollectionIterator(page TagDescriptionCollectionPage) TagDescriptionCollectionIterator { - return TagDescriptionCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tdc TagDescriptionCollection) IsEmpty() bool { - return tdc.Value == nil || len(*tdc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tdc TagDescriptionCollection) hasNextLink() bool { - return tdc.NextLink != nil && len(*tdc.NextLink) != 0 -} - -// tagDescriptionCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tdc TagDescriptionCollection) tagDescriptionCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !tdc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tdc.NextLink))) -} - -// TagDescriptionCollectionPage contains a page of TagDescriptionContract values. -type TagDescriptionCollectionPage struct { - fn func(context.Context, TagDescriptionCollection) (TagDescriptionCollection, error) - tdc TagDescriptionCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *TagDescriptionCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagDescriptionCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.tdc) - if err != nil { - return err - } - page.tdc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *TagDescriptionCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TagDescriptionCollectionPage) NotDone() bool { - return !page.tdc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TagDescriptionCollectionPage) Response() TagDescriptionCollection { - return page.tdc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TagDescriptionCollectionPage) Values() []TagDescriptionContract { - if page.tdc.IsEmpty() { - return nil - } - return *page.tdc.Value -} - -// Creates a new instance of the TagDescriptionCollectionPage type. -func NewTagDescriptionCollectionPage(cur TagDescriptionCollection, getNextPage func(context.Context, TagDescriptionCollection) (TagDescriptionCollection, error)) TagDescriptionCollectionPage { - return TagDescriptionCollectionPage{ - fn: getNextPage, - tdc: cur, - } -} - -// TagDescriptionContract contract details. -type TagDescriptionContract struct { - autorest.Response `json:"-"` - // TagDescriptionContractProperties - TagDescription entity contract properties. - *TagDescriptionContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagDescriptionContract. -func (tdc TagDescriptionContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tdc.TagDescriptionContractProperties != nil { - objectMap["properties"] = tdc.TagDescriptionContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TagDescriptionContract struct. -func (tdc *TagDescriptionContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var tagDescriptionContractProperties TagDescriptionContractProperties - err = json.Unmarshal(*v, &tagDescriptionContractProperties) - if err != nil { - return err - } - tdc.TagDescriptionContractProperties = &tagDescriptionContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tdc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tdc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tdc.Type = &typeVar - } - } - } - - return nil -} - -// TagDescriptionContractProperties tagDescription contract Properties. -type TagDescriptionContractProperties struct { - // TagID - Identifier of the tag in the form of /tags/{tagId} - TagID *string `json:"tagId,omitempty"` - // DisplayName - Tag name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the Tag. - Description *string `json:"description,omitempty"` - // ExternalDocsURL - Absolute URL of external resources describing the tag. - ExternalDocsURL *string `json:"externalDocsUrl,omitempty"` - // ExternalDocsDescription - Description of the external resources describing the tag. - ExternalDocsDescription *string `json:"externalDocsDescription,omitempty"` -} - -// TagDescriptionCreateParameters parameters supplied to the Create TagDescription operation. -type TagDescriptionCreateParameters struct { - // TagDescriptionBaseProperties - Properties supplied to Create TagDescription operation. - *TagDescriptionBaseProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagDescriptionCreateParameters. -func (tdcp TagDescriptionCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tdcp.TagDescriptionBaseProperties != nil { - objectMap["properties"] = tdcp.TagDescriptionBaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TagDescriptionCreateParameters struct. -func (tdcp *TagDescriptionCreateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var tagDescriptionBaseProperties TagDescriptionBaseProperties - err = json.Unmarshal(*v, &tagDescriptionBaseProperties) - if err != nil { - return err - } - tdcp.TagDescriptionBaseProperties = &tagDescriptionBaseProperties - } - } - } - - return nil -} - -// TagResourceCollection paged Tag list representation. -type TagResourceCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]TagResourceContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// TagResourceCollectionIterator provides access to a complete listing of TagResourceContract values. -type TagResourceCollectionIterator struct { - i int - page TagResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *TagResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *TagResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TagResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter TagResourceCollectionIterator) Response() TagResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter TagResourceCollectionIterator) Value() TagResourceContract { - if !iter.page.NotDone() { - return TagResourceContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TagResourceCollectionIterator type. -func NewTagResourceCollectionIterator(page TagResourceCollectionPage) TagResourceCollectionIterator { - return TagResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (trc TagResourceCollection) IsEmpty() bool { - return trc.Value == nil || len(*trc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (trc TagResourceCollection) hasNextLink() bool { - return trc.NextLink != nil && len(*trc.NextLink) != 0 -} - -// tagResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (trc TagResourceCollection) tagResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !trc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(trc.NextLink))) -} - -// TagResourceCollectionPage contains a page of TagResourceContract values. -type TagResourceCollectionPage struct { - fn func(context.Context, TagResourceCollection) (TagResourceCollection, error) - trc TagResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *TagResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.trc) - if err != nil { - return err - } - page.trc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *TagResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TagResourceCollectionPage) NotDone() bool { - return !page.trc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TagResourceCollectionPage) Response() TagResourceCollection { - return page.trc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TagResourceCollectionPage) Values() []TagResourceContract { - if page.trc.IsEmpty() { - return nil - } - return *page.trc.Value -} - -// Creates a new instance of the TagResourceCollectionPage type. -func NewTagResourceCollectionPage(cur TagResourceCollection, getNextPage func(context.Context, TagResourceCollection) (TagResourceCollection, error)) TagResourceCollectionPage { - return TagResourceCollectionPage{ - fn: getNextPage, - trc: cur, - } -} - -// TagResourceContract tagResource contract properties. -type TagResourceContract struct { - // Tag - Tag associated with the resource. - Tag *TagTagResourceContractProperties `json:"tag,omitempty"` - // API - API associated with the tag. - API *APITagResourceContractProperties `json:"api,omitempty"` - // Operation - Operation associated with the tag. - Operation *OperationTagResourceContractProperties `json:"operation,omitempty"` - // Product - Product associated with the tag. - Product *ProductTagResourceContractProperties `json:"product,omitempty"` -} - -// TagTagResourceContractProperties contract defining the Tag property in the Tag Resource Contract -type TagTagResourceContractProperties struct { - // ID - Tag identifier - ID *string `json:"id,omitempty"` - // Name - Tag Name - Name *string `json:"name,omitempty"` -} - -// TenantConfigurationDeployFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TenantConfigurationDeployFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TenantConfigurationClient) (OperationResultContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TenantConfigurationDeployFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for TenantConfigurationDeployFuture.Result. -func (future *TenantConfigurationDeployFuture) result(client TenantConfigurationClient) (orc OperationResultContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationDeployFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - orc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.TenantConfigurationDeployFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if orc.Response.Response, err = future.GetResult(sender); err == nil && orc.Response.Response.StatusCode != http.StatusNoContent { - orc, err = client.DeployResponder(orc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationDeployFuture", "Result", orc.Response.Response, "Failure responding to request") - } - } - return -} - -// TenantConfigurationSaveFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TenantConfigurationSaveFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TenantConfigurationClient) (OperationResultContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TenantConfigurationSaveFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for TenantConfigurationSaveFuture.Result. -func (future *TenantConfigurationSaveFuture) result(client TenantConfigurationClient) (orc OperationResultContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationSaveFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - orc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.TenantConfigurationSaveFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if orc.Response.Response, err = future.GetResult(sender); err == nil && orc.Response.Response.StatusCode != http.StatusNoContent { - orc, err = client.SaveResponder(orc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationSaveFuture", "Result", orc.Response.Response, "Failure responding to request") - } - } - return -} - -// TenantConfigurationSyncStateContract result of Tenant Configuration Sync State. -type TenantConfigurationSyncStateContract struct { - autorest.Response `json:"-"` - // TenantConfigurationSyncStateContractProperties - Properties returned Tenant Configuration Sync State check. - *TenantConfigurationSyncStateContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TenantConfigurationSyncStateContract. -func (tcssc TenantConfigurationSyncStateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tcssc.TenantConfigurationSyncStateContractProperties != nil { - objectMap["properties"] = tcssc.TenantConfigurationSyncStateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TenantConfigurationSyncStateContract struct. -func (tcssc *TenantConfigurationSyncStateContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var tenantConfigurationSyncStateContractProperties TenantConfigurationSyncStateContractProperties - err = json.Unmarshal(*v, &tenantConfigurationSyncStateContractProperties) - if err != nil { - return err - } - tcssc.TenantConfigurationSyncStateContractProperties = &tenantConfigurationSyncStateContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tcssc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tcssc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tcssc.Type = &typeVar - } - } - } - - return nil -} - -// TenantConfigurationSyncStateContractProperties tenant Configuration Synchronization State. -type TenantConfigurationSyncStateContractProperties struct { - // Branch - The name of Git branch. - Branch *string `json:"branch,omitempty"` - // CommitID - The latest commit Id. - CommitID *string `json:"commitId,omitempty"` - // IsExport - value indicating if last sync was save (true) or deploy (false) operation. - IsExport *bool `json:"isExport,omitempty"` - // IsSynced - value indicating if last synchronization was later than the configuration change. - IsSynced *bool `json:"isSynced,omitempty"` - // IsGitEnabled - value indicating whether Git configuration access is enabled. - IsGitEnabled *bool `json:"isGitEnabled,omitempty"` - // SyncDate - The date of the latest synchronization. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - SyncDate *date.Time `json:"syncDate,omitempty"` - // ConfigurationChangeDate - The date of the latest configuration change. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - ConfigurationChangeDate *date.Time `json:"configurationChangeDate,omitempty"` - // LastOperationID - Most recent tenant configuration operation identifier - LastOperationID *string `json:"lastOperationId,omitempty"` -} - -// TenantConfigurationValidateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TenantConfigurationValidateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TenantConfigurationClient) (OperationResultContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TenantConfigurationValidateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for TenantConfigurationValidateFuture.Result. -func (future *TenantConfigurationValidateFuture) result(client TenantConfigurationClient) (orc OperationResultContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationValidateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - orc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.TenantConfigurationValidateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if orc.Response.Response, err = future.GetResult(sender); err == nil && orc.Response.Response.StatusCode != http.StatusNoContent { - orc, err = client.ValidateResponder(orc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationValidateFuture", "Result", orc.Response.Response, "Failure responding to request") - } - } - return -} - -// TenantSettingsCollection paged AccessInformation list representation. -type TenantSettingsCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]TenantSettingsContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for TenantSettingsCollection. -func (tsc TenantSettingsCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TenantSettingsCollectionIterator provides access to a complete listing of TenantSettingsContract values. -type TenantSettingsCollectionIterator struct { - i int - page TenantSettingsCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *TenantSettingsCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantSettingsCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *TenantSettingsCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TenantSettingsCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter TenantSettingsCollectionIterator) Response() TenantSettingsCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter TenantSettingsCollectionIterator) Value() TenantSettingsContract { - if !iter.page.NotDone() { - return TenantSettingsContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TenantSettingsCollectionIterator type. -func NewTenantSettingsCollectionIterator(page TenantSettingsCollectionPage) TenantSettingsCollectionIterator { - return TenantSettingsCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tsc TenantSettingsCollection) IsEmpty() bool { - return tsc.Value == nil || len(*tsc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tsc TenantSettingsCollection) hasNextLink() bool { - return tsc.NextLink != nil && len(*tsc.NextLink) != 0 -} - -// tenantSettingsCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tsc TenantSettingsCollection) tenantSettingsCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !tsc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tsc.NextLink))) -} - -// TenantSettingsCollectionPage contains a page of TenantSettingsContract values. -type TenantSettingsCollectionPage struct { - fn func(context.Context, TenantSettingsCollection) (TenantSettingsCollection, error) - tsc TenantSettingsCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *TenantSettingsCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantSettingsCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.tsc) - if err != nil { - return err - } - page.tsc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *TenantSettingsCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TenantSettingsCollectionPage) NotDone() bool { - return !page.tsc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TenantSettingsCollectionPage) Response() TenantSettingsCollection { - return page.tsc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TenantSettingsCollectionPage) Values() []TenantSettingsContract { - if page.tsc.IsEmpty() { - return nil - } - return *page.tsc.Value -} - -// Creates a new instance of the TenantSettingsCollectionPage type. -func NewTenantSettingsCollectionPage(cur TenantSettingsCollection, getNextPage func(context.Context, TenantSettingsCollection) (TenantSettingsCollection, error)) TenantSettingsCollectionPage { - return TenantSettingsCollectionPage{ - fn: getNextPage, - tsc: cur, - } -} - -// TenantSettingsContract tenant Settings. -type TenantSettingsContract struct { - autorest.Response `json:"-"` - // TenantSettingsContractProperties - TenantSettings entity contract properties. - *TenantSettingsContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TenantSettingsContract. -func (tsc TenantSettingsContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsc.TenantSettingsContractProperties != nil { - objectMap["properties"] = tsc.TenantSettingsContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TenantSettingsContract struct. -func (tsc *TenantSettingsContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var tenantSettingsContractProperties TenantSettingsContractProperties - err = json.Unmarshal(*v, &tenantSettingsContractProperties) - if err != nil { - return err - } - tsc.TenantSettingsContractProperties = &tenantSettingsContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsc.Type = &typeVar - } - } - } - - return nil -} - -// TenantSettingsContractProperties tenant access information contract of the API Management service. -type TenantSettingsContractProperties struct { - // Settings - Tenant settings - Settings map[string]*string `json:"settings"` -} - -// MarshalJSON is the custom marshaler for TenantSettingsContractProperties. -func (tscp TenantSettingsContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tscp.Settings != nil { - objectMap["settings"] = tscp.Settings - } - return json.Marshal(objectMap) -} - -// TermsOfServiceProperties terms of service contract properties. -type TermsOfServiceProperties struct { - // Text - A terms of service text. - Text *string `json:"text,omitempty"` - // Enabled - Display terms of service during a sign-up process. - Enabled *bool `json:"enabled,omitempty"` - // ConsentRequired - Ask user for consent to the terms of service. - ConsentRequired *bool `json:"consentRequired,omitempty"` -} - -// TokenBodyParameterContract oAuth acquire token request body parameter (www-url-form-encoded). -type TokenBodyParameterContract struct { - // Name - body parameter name. - Name *string `json:"name,omitempty"` - // Value - body parameter value. - Value *string `json:"value,omitempty"` -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// UserCollection paged Users list representation. -type UserCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]UserContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// UserCollectionIterator provides access to a complete listing of UserContract values. -type UserCollectionIterator struct { - i int - page UserCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *UserCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *UserCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter UserCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter UserCollectionIterator) Response() UserCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter UserCollectionIterator) Value() UserContract { - if !iter.page.NotDone() { - return UserContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the UserCollectionIterator type. -func NewUserCollectionIterator(page UserCollectionPage) UserCollectionIterator { - return UserCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (uc UserCollection) IsEmpty() bool { - return uc.Value == nil || len(*uc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (uc UserCollection) hasNextLink() bool { - return uc.NextLink != nil && len(*uc.NextLink) != 0 -} - -// userCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (uc UserCollection) userCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !uc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(uc.NextLink))) -} - -// UserCollectionPage contains a page of UserContract values. -type UserCollectionPage struct { - fn func(context.Context, UserCollection) (UserCollection, error) - uc UserCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *UserCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.uc) - if err != nil { - return err - } - page.uc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *UserCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page UserCollectionPage) NotDone() bool { - return !page.uc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page UserCollectionPage) Response() UserCollection { - return page.uc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page UserCollectionPage) Values() []UserContract { - if page.uc.IsEmpty() { - return nil - } - return *page.uc.Value -} - -// Creates a new instance of the UserCollectionPage type. -func NewUserCollectionPage(cur UserCollection, getNextPage func(context.Context, UserCollection) (UserCollection, error)) UserCollectionPage { - return UserCollectionPage{ - fn: getNextPage, - uc: cur, - } -} - -// UserContract user details. -type UserContract struct { - autorest.Response `json:"-"` - // UserContractProperties - User entity contract properties. - *UserContractProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserContract. -func (uc UserContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if uc.UserContractProperties != nil { - objectMap["properties"] = uc.UserContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserContract struct. -func (uc *UserContract) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var userContractProperties UserContractProperties - err = json.Unmarshal(*v, &userContractProperties) - if err != nil { - return err - } - uc.UserContractProperties = &userContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - uc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - uc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - uc.Type = &typeVar - } - } - } - - return nil -} - -// UserContractProperties user profile. -type UserContractProperties struct { - // FirstName - First name. - FirstName *string `json:"firstName,omitempty"` - // LastName - Last name. - LastName *string `json:"lastName,omitempty"` - // Email - Email address. - Email *string `json:"email,omitempty"` - // RegistrationDate - Date of user registration. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - RegistrationDate *date.Time `json:"registrationDate,omitempty"` - // Groups - READ-ONLY; Collection of groups user is part of. - Groups *[]GroupContractProperties `json:"groups,omitempty"` - // State - Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'UserStateActive', 'UserStateBlocked', 'UserStatePending', 'UserStateDeleted' - State UserState `json:"state,omitempty"` - // Note - Optional note about a user set by the administrator. - Note *string `json:"note,omitempty"` - // Identities - Collection of user identities. - Identities *[]UserIdentityContract `json:"identities,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserContractProperties. -func (ucp UserContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ucp.FirstName != nil { - objectMap["firstName"] = ucp.FirstName - } - if ucp.LastName != nil { - objectMap["lastName"] = ucp.LastName - } - if ucp.Email != nil { - objectMap["email"] = ucp.Email - } - if ucp.RegistrationDate != nil { - objectMap["registrationDate"] = ucp.RegistrationDate - } - if ucp.State != "" { - objectMap["state"] = ucp.State - } - if ucp.Note != nil { - objectMap["note"] = ucp.Note - } - if ucp.Identities != nil { - objectMap["identities"] = ucp.Identities - } - return json.Marshal(objectMap) -} - -// UserCreateParameterProperties parameters supplied to the Create User operation. -type UserCreateParameterProperties struct { - // Email - Email address. Must not be empty and must be unique within the service instance. - Email *string `json:"email,omitempty"` - // FirstName - First name. - FirstName *string `json:"firstName,omitempty"` - // LastName - Last name. - LastName *string `json:"lastName,omitempty"` - // Password - User Password. If no value is provided, a default password is generated. - Password *string `json:"password,omitempty"` - // AppType - Determines the type of application which send the create user request. Default is legacy portal. Possible values include: 'AppTypePortal', 'AppTypeDeveloperPortal' - AppType AppType `json:"appType,omitempty"` - // Confirmation - Determines the type of confirmation e-mail that will be sent to the newly created user. Possible values include: 'ConfirmationSignup', 'ConfirmationInvite' - Confirmation Confirmation `json:"confirmation,omitempty"` - // State - Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'UserStateActive', 'UserStateBlocked', 'UserStatePending', 'UserStateDeleted' - State UserState `json:"state,omitempty"` - // Note - Optional note about a user set by the administrator. - Note *string `json:"note,omitempty"` - // Identities - Collection of user identities. - Identities *[]UserIdentityContract `json:"identities,omitempty"` -} - -// UserCreateParameters user create details. -type UserCreateParameters struct { - // UserCreateParameterProperties - User entity create contract properties. - *UserCreateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserCreateParameters. -func (ucp UserCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ucp.UserCreateParameterProperties != nil { - objectMap["properties"] = ucp.UserCreateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserCreateParameters struct. -func (ucp *UserCreateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var userCreateParameterProperties UserCreateParameterProperties - err = json.Unmarshal(*v, &userCreateParameterProperties) - if err != nil { - return err - } - ucp.UserCreateParameterProperties = &userCreateParameterProperties - } - } - } - - return nil -} - -// UserEntityBaseParameters user Entity Base Parameters set. -type UserEntityBaseParameters struct { - // State - Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'UserStateActive', 'UserStateBlocked', 'UserStatePending', 'UserStateDeleted' - State UserState `json:"state,omitempty"` - // Note - Optional note about a user set by the administrator. - Note *string `json:"note,omitempty"` - // Identities - Collection of user identities. - Identities *[]UserIdentityContract `json:"identities,omitempty"` -} - -// UserIdentityCollection list of Users Identity list representation. -type UserIdentityCollection struct { - autorest.Response `json:"-"` - // Value - User Identity values. - Value *[]UserIdentityContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// UserIdentityCollectionIterator provides access to a complete listing of UserIdentityContract values. -type UserIdentityCollectionIterator struct { - i int - page UserIdentityCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *UserIdentityCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserIdentityCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *UserIdentityCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter UserIdentityCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter UserIdentityCollectionIterator) Response() UserIdentityCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter UserIdentityCollectionIterator) Value() UserIdentityContract { - if !iter.page.NotDone() { - return UserIdentityContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the UserIdentityCollectionIterator type. -func NewUserIdentityCollectionIterator(page UserIdentityCollectionPage) UserIdentityCollectionIterator { - return UserIdentityCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (uic UserIdentityCollection) IsEmpty() bool { - return uic.Value == nil || len(*uic.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (uic UserIdentityCollection) hasNextLink() bool { - return uic.NextLink != nil && len(*uic.NextLink) != 0 -} - -// userIdentityCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (uic UserIdentityCollection) userIdentityCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !uic.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(uic.NextLink))) -} - -// UserIdentityCollectionPage contains a page of UserIdentityContract values. -type UserIdentityCollectionPage struct { - fn func(context.Context, UserIdentityCollection) (UserIdentityCollection, error) - uic UserIdentityCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *UserIdentityCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserIdentityCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.uic) - if err != nil { - return err - } - page.uic = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *UserIdentityCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page UserIdentityCollectionPage) NotDone() bool { - return !page.uic.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page UserIdentityCollectionPage) Response() UserIdentityCollection { - return page.uic -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page UserIdentityCollectionPage) Values() []UserIdentityContract { - if page.uic.IsEmpty() { - return nil - } - return *page.uic.Value -} - -// Creates a new instance of the UserIdentityCollectionPage type. -func NewUserIdentityCollectionPage(cur UserIdentityCollection, getNextPage func(context.Context, UserIdentityCollection) (UserIdentityCollection, error)) UserIdentityCollectionPage { - return UserIdentityCollectionPage{ - fn: getNextPage, - uic: cur, - } -} - -// UserIdentityContract user identity details. -type UserIdentityContract struct { - // Provider - Identity provider name. - Provider *string `json:"provider,omitempty"` - // ID - Identifier value within provider. - ID *string `json:"id,omitempty"` -} - -// UserIdentityProperties ... -type UserIdentityProperties struct { - // PrincipalID - The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// UserTokenParameterProperties parameters supplied to the Get User Token operation. -type UserTokenParameterProperties struct { - // KeyType - The Key to be used to generate token for user. Possible values include: 'KeyTypePrimary', 'KeyTypeSecondary' - KeyType KeyType `json:"keyType,omitempty"` - // Expiry - The Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Expiry *date.Time `json:"expiry,omitempty"` -} - -// UserTokenParameters get User Token parameters. -type UserTokenParameters struct { - // UserTokenParameterProperties - User Token Parameter contract properties. - *UserTokenParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserTokenParameters. -func (utp UserTokenParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if utp.UserTokenParameterProperties != nil { - objectMap["properties"] = utp.UserTokenParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserTokenParameters struct. -func (utp *UserTokenParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var userTokenParameterProperties UserTokenParameterProperties - err = json.Unmarshal(*v, &userTokenParameterProperties) - if err != nil { - return err - } - utp.UserTokenParameterProperties = &userTokenParameterProperties - } - } - } - - return nil -} - -// UserTokenResult get User Token response details. -type UserTokenResult struct { - autorest.Response `json:"-"` - // Value - Shared Access Authorization token for the User. - Value *string `json:"value,omitempty"` -} - -// UserUpdateParameters user update parameters. -type UserUpdateParameters struct { - // UserUpdateParametersProperties - User entity update contract properties. - *UserUpdateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserUpdateParameters. -func (uup UserUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if uup.UserUpdateParametersProperties != nil { - objectMap["properties"] = uup.UserUpdateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserUpdateParameters struct. -func (uup *UserUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var userUpdateParametersProperties UserUpdateParametersProperties - err = json.Unmarshal(*v, &userUpdateParametersProperties) - if err != nil { - return err - } - uup.UserUpdateParametersProperties = &userUpdateParametersProperties - } - } - } - - return nil -} - -// UserUpdateParametersProperties parameters supplied to the Update User operation. -type UserUpdateParametersProperties struct { - // Email - Email address. Must not be empty and must be unique within the service instance. - Email *string `json:"email,omitempty"` - // Password - User Password. - Password *string `json:"password,omitempty"` - // FirstName - First name. - FirstName *string `json:"firstName,omitempty"` - // LastName - Last name. - LastName *string `json:"lastName,omitempty"` - // State - Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'UserStateActive', 'UserStateBlocked', 'UserStatePending', 'UserStateDeleted' - State UserState `json:"state,omitempty"` - // Note - Optional note about a user set by the administrator. - Note *string `json:"note,omitempty"` - // Identities - Collection of user identities. - Identities *[]UserIdentityContract `json:"identities,omitempty"` -} - -// VirtualNetworkConfiguration configuration of a virtual network to which API Management service is -// deployed. -type VirtualNetworkConfiguration struct { - // Vnetid - READ-ONLY; The virtual network ID. This is typically a GUID. Expect a null GUID by default. - Vnetid *string `json:"vnetid,omitempty"` - // Subnetname - READ-ONLY; The name of the subnet. - Subnetname *string `json:"subnetname,omitempty"` - // SubnetResourceID - The full resource ID of a subnet in a virtual network to deploy the API Management service in. - SubnetResourceID *string `json:"subnetResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkConfiguration. -func (vnc VirtualNetworkConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnc.SubnetResourceID != nil { - objectMap["subnetResourceId"] = vnc.SubnetResourceID - } - return json.Marshal(objectMap) -} - -// X509CertificateName properties of server X509Names. -type X509CertificateName struct { - // Name - Common Name of the Certificate. - Name *string `json:"name,omitempty"` - // IssuerCertificateThumbprint - Thumbprint for the Issuer of the Certificate. - IssuerCertificateThumbprint *string `json:"issuerCertificateThumbprint,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/namedvalue.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/namedvalue.go deleted file mode 100644 index ff93295206ac..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/namedvalue.go +++ /dev/null @@ -1,841 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// NamedValueClient is the apiManagement Client -type NamedValueClient struct { - BaseClient -} - -// NewNamedValueClient creates an instance of the NamedValueClient client. -func NewNamedValueClient(subscriptionID string) NamedValueClient { - return NewNamedValueClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNamedValueClientWithBaseURI creates an instance of the NamedValueClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewNamedValueClientWithBaseURI(baseURI string, subscriptionID string) NamedValueClient { - return NamedValueClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates named value. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// namedValueID - identifier of the NamedValue. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client NamedValueClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, parameters NamedValueCreateContract, ifMatch string) (result NamedValueCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: namedValueID, - Constraints: []validation.Constraint{{Target: "namedValueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "namedValueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.NamedValueCreateContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.NamedValueCreateContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.NamedValueCreateContractProperties.DisplayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "parameters.NamedValueCreateContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "parameters.NamedValueCreateContractProperties.DisplayName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-._]+$`, Chain: nil}, - }}, - {Target: "parameters.NamedValueCreateContractProperties.Value", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.NamedValueCreateContractProperties.Value", Name: validation.MaxLength, Rule: 4096, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.NamedValueClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, namedValueID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NamedValueClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, parameters NamedValueCreateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namedValueId": autorest.Encode("path", namedValueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NamedValueClient) CreateOrUpdateSender(req *http.Request) (future NamedValueCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client NamedValueClient) CreateOrUpdateResponder(resp *http.Response) (result NamedValueContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes specific named value from the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// namedValueID - identifier of the NamedValue. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client NamedValueClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: namedValueID, - Constraints: []validation.Constraint{{Target: "namedValueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "namedValueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NamedValueClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, namedValueID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NamedValueClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namedValueId": autorest.Encode("path", namedValueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client NamedValueClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client NamedValueClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the named value specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// namedValueID - identifier of the NamedValue. -func (client NamedValueClient) Get(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (result NamedValueContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: namedValueID, - Constraints: []validation.Constraint{{Target: "namedValueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "namedValueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NamedValueClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, namedValueID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NamedValueClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namedValueId": autorest.Encode("path", namedValueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client NamedValueClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client NamedValueClient) GetResponder(resp *http.Response) (result NamedValueContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the named value specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// namedValueID - identifier of the NamedValue. -func (client NamedValueClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: namedValueID, - Constraints: []validation.Constraint{{Target: "namedValueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "namedValueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NamedValueClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, namedValueID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client NamedValueClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namedValueId": autorest.Encode("path", namedValueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client NamedValueClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client NamedValueClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of named values defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| tags | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith, any, all |
| displayName | filter | ge, le, eq, ne, gt, -// lt | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -// isKeyVaultRefreshFailed - when set to true, the response contains only named value entities which failed -// refresh. -func (client NamedValueClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, isKeyVaultRefreshFailed *bool) (result NamedValueCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.ListByService") - defer func() { - sc := -1 - if result.nvc.Response.Response != nil { - sc = result.nvc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.NamedValueClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip, isKeyVaultRefreshFailed) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.nvc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "ListByService", resp, "Failure sending request") - return - } - - result.nvc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "ListByService", resp, "Failure responding to request") - return - } - if result.nvc.hasNextLink() && result.nvc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client NamedValueClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, isKeyVaultRefreshFailed *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if isKeyVaultRefreshFailed != nil { - queryParameters["isKeyVaultRefreshFailed"] = autorest.Encode("query", *isKeyVaultRefreshFailed) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client NamedValueClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client NamedValueClient) ListByServiceResponder(resp *http.Response) (result NamedValueCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client NamedValueClient) listByServiceNextResults(ctx context.Context, lastResults NamedValueCollection) (result NamedValueCollection, err error) { - req, err := lastResults.namedValueCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client NamedValueClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, isKeyVaultRefreshFailed *bool) (result NamedValueCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip, isKeyVaultRefreshFailed) - return -} - -// ListValue gets the secret of the named value specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// namedValueID - identifier of the NamedValue. -func (client NamedValueClient) ListValue(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (result NamedValueSecretContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.ListValue") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: namedValueID, - Constraints: []validation.Constraint{{Target: "namedValueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "namedValueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NamedValueClient", "ListValue", err.Error()) - } - - req, err := client.ListValuePreparer(ctx, resourceGroupName, serviceName, namedValueID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "ListValue", nil, "Failure preparing request") - return - } - - resp, err := client.ListValueSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "ListValue", resp, "Failure sending request") - return - } - - result, err = client.ListValueResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "ListValue", resp, "Failure responding to request") - return - } - - return -} - -// ListValuePreparer prepares the ListValue request. -func (client NamedValueClient) ListValuePreparer(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namedValueId": autorest.Encode("path", namedValueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/listValue", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListValueSender sends the ListValue request. The method will close the -// http.Response Body if it receives an error. -func (client NamedValueClient) ListValueSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListValueResponder handles the response to the ListValue request. The method always -// closes the http.Response Body. -func (client NamedValueClient) ListValueResponder(resp *http.Response) (result NamedValueSecretContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RefreshSecret refresh the secret of the named value specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// namedValueID - identifier of the NamedValue. -func (client NamedValueClient) RefreshSecret(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (result NamedValueRefreshSecretFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.RefreshSecret") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: namedValueID, - Constraints: []validation.Constraint{{Target: "namedValueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "namedValueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NamedValueClient", "RefreshSecret", err.Error()) - } - - req, err := client.RefreshSecretPreparer(ctx, resourceGroupName, serviceName, namedValueID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "RefreshSecret", nil, "Failure preparing request") - return - } - - result, err = client.RefreshSecretSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "RefreshSecret", result.Response(), "Failure sending request") - return - } - - return -} - -// RefreshSecretPreparer prepares the RefreshSecret request. -func (client NamedValueClient) RefreshSecretPreparer(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namedValueId": autorest.Encode("path", namedValueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RefreshSecretSender sends the RefreshSecret request. The method will close the -// http.Response Body if it receives an error. -func (client NamedValueClient) RefreshSecretSender(req *http.Request) (future NamedValueRefreshSecretFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RefreshSecretResponder handles the response to the RefreshSecret request. The method always -// closes the http.Response Body. -func (client NamedValueClient) RefreshSecretResponder(resp *http.Response) (result NamedValueContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates the specific named value. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// namedValueID - identifier of the NamedValue. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client NamedValueClient) Update(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, parameters NamedValueUpdateParameters, ifMatch string) (result NamedValueUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: namedValueID, - Constraints: []validation.Constraint{{Target: "namedValueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "namedValueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NamedValueClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, namedValueID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client NamedValueClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, parameters NamedValueUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namedValueId": autorest.Encode("path", namedValueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client NamedValueClient) UpdateSender(req *http.Request) (future NamedValueUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client NamedValueClient) UpdateResponder(resp *http.Response) (result NamedValueContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/networkstatus.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/networkstatus.go deleted file mode 100644 index d97b309520b8..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/networkstatus.go +++ /dev/null @@ -1,207 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// NetworkStatusClient is the apiManagement Client -type NetworkStatusClient struct { - BaseClient -} - -// NewNetworkStatusClient creates an instance of the NetworkStatusClient client. -func NewNetworkStatusClient(subscriptionID string) NetworkStatusClient { - return NewNetworkStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNetworkStatusClientWithBaseURI creates an instance of the NetworkStatusClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewNetworkStatusClientWithBaseURI(baseURI string, subscriptionID string) NetworkStatusClient { - return NetworkStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByLocation gets the Connectivity Status to the external resources on which the Api Management service depends -// from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// locationName - location in which the API Management service is deployed. This is one of the Azure Regions -// like West US, East US, South Central US. -func (client NetworkStatusClient) ListByLocation(ctx context.Context, resourceGroupName string, serviceName string, locationName string) (result NetworkStatusContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkStatusClient.ListByLocation") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: locationName, - Constraints: []validation.Constraint{{Target: "locationName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NetworkStatusClient", "ListByLocation", err.Error()) - } - - req, err := client.ListByLocationPreparer(ctx, resourceGroupName, serviceName, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByLocation", resp, "Failure sending request") - return - } - - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByLocation", resp, "Failure responding to request") - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client NetworkStatusClient) ListByLocationPreparer(ctx context.Context, resourceGroupName string, serviceName string, locationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkStatusClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client NetworkStatusClient) ListByLocationResponder(resp *http.Response) (result NetworkStatusContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService gets the Connectivity Status to the external resources on which the Api Management service depends -// from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client NetworkStatusClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result ListNetworkStatusContractByLocation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkStatusClient.ListByService") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NetworkStatusClient", "ListByService", err.Error()) - } - - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByService", resp, "Failure responding to request") - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client NetworkStatusClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkStatusClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client NetworkStatusClient) ListByServiceResponder(resp *http.Response) (result ListNetworkStatusContractByLocation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/notification.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/notification.go deleted file mode 100644 index 3244865dbf6f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/notification.go +++ /dev/null @@ -1,349 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// NotificationClient is the apiManagement Client -type NotificationClient struct { - BaseClient -} - -// NewNotificationClient creates an instance of the NotificationClient client. -func NewNotificationClient(subscriptionID string) NotificationClient { - return NewNotificationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotificationClientWithBaseURI creates an instance of the NotificationClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewNotificationClientWithBaseURI(baseURI string, subscriptionID string) NotificationClient { - return NotificationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update API Management publisher notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client NotificationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, ifMatch string) (result NotificationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, notificationName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotificationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client NotificationClient) CreateOrUpdateResponder(resp *http.Response) (result NotificationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the details of the Notification specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -func (client NotificationClient) Get(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (result NotificationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, notificationName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NotificationClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client NotificationClient) GetResponder(resp *http.Response) (result NotificationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of properties defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// top - number of records to return. -// skip - number of records to skip. -func (client NotificationClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result NotificationCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationClient.ListByService") - defer func() { - sc := -1 - if result.nc.Response.Response != nil { - sc = result.nc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.nc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "ListByService", resp, "Failure sending request") - return - } - - result.nc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "ListByService", resp, "Failure responding to request") - return - } - if result.nc.hasNextLink() && result.nc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client NotificationClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client NotificationClient) ListByServiceResponder(resp *http.Response) (result NotificationCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client NotificationClient) listByServiceNextResults(ctx context.Context, lastResults NotificationCollection) (result NotificationCollection, err error) { - req, err := lastResults.notificationCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client NotificationClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result NotificationCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/notificationrecipientemail.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/notificationrecipientemail.go deleted file mode 100644 index deaa590f236c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/notificationrecipientemail.go +++ /dev/null @@ -1,381 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// NotificationRecipientEmailClient is the apiManagement Client -type NotificationRecipientEmailClient struct { - BaseClient -} - -// NewNotificationRecipientEmailClient creates an instance of the NotificationRecipientEmailClient client. -func NewNotificationRecipientEmailClient(subscriptionID string) NotificationRecipientEmailClient { - return NewNotificationRecipientEmailClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotificationRecipientEmailClientWithBaseURI creates an instance of the NotificationRecipientEmailClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewNotificationRecipientEmailClientWithBaseURI(baseURI string, subscriptionID string) NotificationRecipientEmailClient { - return NotificationRecipientEmailClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckEntityExists determine if Notification Recipient Email subscribed to the notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// email - email identifier. -func (client NotificationRecipientEmailClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientEmailClient.CheckEntityExists") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientEmailClient", "CheckEntityExists", err.Error()) - } - - req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, notificationName, email) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckEntityExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CheckEntityExists", resp, "Failure sending request") - return - } - - result, err = client.CheckEntityExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CheckEntityExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckEntityExistsPreparer prepares the CheckEntityExists request. -func (client NotificationRecipientEmailClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "email": autorest.Encode("path", email), - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientEmailClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (client NotificationRecipientEmailClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate adds the Email address to the list of Recipients for the Notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// email - email identifier. -func (client NotificationRecipientEmailClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (result RecipientEmailContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientEmailClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientEmailClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, notificationName, email) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotificationRecipientEmailClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "email": autorest.Encode("path", email), - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientEmailClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client NotificationRecipientEmailClient) CreateOrUpdateResponder(resp *http.Response) (result RecipientEmailContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete removes the email from the list of Notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// email - email identifier. -func (client NotificationRecipientEmailClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientEmailClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientEmailClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, notificationName, email) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NotificationRecipientEmailClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "email": autorest.Encode("path", email), - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientEmailClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client NotificationRecipientEmailClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByNotification gets the list of the Notification Recipient Emails subscribed to a notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -func (client NotificationRecipientEmailClient) ListByNotification(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (result RecipientEmailCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientEmailClient.ListByNotification") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientEmailClient", "ListByNotification", err.Error()) - } - - req, err := client.ListByNotificationPreparer(ctx, resourceGroupName, serviceName, notificationName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "ListByNotification", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNotificationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "ListByNotification", resp, "Failure sending request") - return - } - - result, err = client.ListByNotificationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "ListByNotification", resp, "Failure responding to request") - return - } - - return -} - -// ListByNotificationPreparer prepares the ListByNotification request. -func (client NotificationRecipientEmailClient) ListByNotificationPreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNotificationSender sends the ListByNotification request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientEmailClient) ListByNotificationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNotificationResponder handles the response to the ListByNotification request. The method always -// closes the http.Response Body. -func (client NotificationRecipientEmailClient) ListByNotificationResponder(resp *http.Response) (result RecipientEmailCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/notificationrecipientuser.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/notificationrecipientuser.go deleted file mode 100644 index 434eec68af73..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/notificationrecipientuser.go +++ /dev/null @@ -1,390 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// NotificationRecipientUserClient is the apiManagement Client -type NotificationRecipientUserClient struct { - BaseClient -} - -// NewNotificationRecipientUserClient creates an instance of the NotificationRecipientUserClient client. -func NewNotificationRecipientUserClient(subscriptionID string) NotificationRecipientUserClient { - return NewNotificationRecipientUserClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotificationRecipientUserClientWithBaseURI creates an instance of the NotificationRecipientUserClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewNotificationRecipientUserClientWithBaseURI(baseURI string, subscriptionID string) NotificationRecipientUserClient { - return NotificationRecipientUserClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckEntityExists determine if the Notification Recipient User is subscribed to the notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client NotificationRecipientUserClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientUserClient.CheckEntityExists") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientUserClient", "CheckEntityExists", err.Error()) - } - - req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, notificationName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckEntityExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CheckEntityExists", resp, "Failure sending request") - return - } - - result, err = client.CheckEntityExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CheckEntityExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckEntityExistsPreparer prepares the CheckEntityExists request. -func (client NotificationRecipientUserClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientUserClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (client NotificationRecipientUserClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate adds the API Management User to the list of Recipients for the Notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client NotificationRecipientUserClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (result RecipientUserContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientUserClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientUserClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, notificationName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotificationRecipientUserClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientUserClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client NotificationRecipientUserClient) CreateOrUpdateResponder(resp *http.Response) (result RecipientUserContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete removes the API Management user from the list of Notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client NotificationRecipientUserClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientUserClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientUserClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, notificationName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NotificationRecipientUserClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientUserClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client NotificationRecipientUserClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByNotification gets the list of the Notification Recipient User subscribed to the notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -func (client NotificationRecipientUserClient) ListByNotification(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (result RecipientUserCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientUserClient.ListByNotification") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientUserClient", "ListByNotification", err.Error()) - } - - req, err := client.ListByNotificationPreparer(ctx, resourceGroupName, serviceName, notificationName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "ListByNotification", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNotificationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "ListByNotification", resp, "Failure sending request") - return - } - - result, err = client.ListByNotificationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "ListByNotification", resp, "Failure responding to request") - return - } - - return -} - -// ListByNotificationPreparer prepares the ListByNotification request. -func (client NotificationRecipientUserClient) ListByNotificationPreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNotificationSender sends the ListByNotification request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientUserClient) ListByNotificationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNotificationResponder handles the response to the ListByNotification request. The method always -// closes the http.Response Body. -func (client NotificationRecipientUserClient) ListByNotificationResponder(resp *http.Response) (result RecipientUserCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/openidconnectprovider.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/openidconnectprovider.go deleted file mode 100644 index 66a61c2921a2..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/openidconnectprovider.go +++ /dev/null @@ -1,736 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OpenIDConnectProviderClient is the apiManagement Client -type OpenIDConnectProviderClient struct { - BaseClient -} - -// NewOpenIDConnectProviderClient creates an instance of the OpenIDConnectProviderClient client. -func NewOpenIDConnectProviderClient(subscriptionID string) OpenIDConnectProviderClient { - return NewOpenIDConnectProviderClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOpenIDConnectProviderClientWithBaseURI creates an instance of the OpenIDConnectProviderClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewOpenIDConnectProviderClientWithBaseURI(baseURI string, subscriptionID string) OpenIDConnectProviderClient { - return OpenIDConnectProviderClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the OpenID Connect Provider. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client OpenIDConnectProviderClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderContract, ifMatch string) (result OpenidConnectProviderContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.OpenidConnectProviderContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.OpenidConnectProviderContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.OpenidConnectProviderContractProperties.DisplayName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, - {Target: "parameters.OpenidConnectProviderContractProperties.MetadataEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.OpenidConnectProviderContractProperties.ClientID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, opid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client OpenIDConnectProviderClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProviderClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProviderClient) CreateOrUpdateResponder(resp *http.Response) (result OpenidConnectProviderContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes specific OpenID Connect Provider of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client OpenIDConnectProviderClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, opid string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, opid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client OpenIDConnectProviderClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProviderClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProviderClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets specific OpenID Connect Provider without secrets. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -func (client OpenIDConnectProviderClient) Get(ctx context.Context, resourceGroupName string, serviceName string, opid string) (result OpenidConnectProviderContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, opid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client OpenIDConnectProviderClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProviderClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProviderClient) GetResponder(resp *http.Response) (result OpenidConnectProviderContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the openIdConnectProvider specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -func (client OpenIDConnectProviderClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, opid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, opid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client OpenIDConnectProviderClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProviderClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProviderClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists of all the OpenId Connect Providers. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client OpenIDConnectProviderClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result OpenIDConnectProviderCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.ListByService") - defer func() { - sc := -1 - if result.oicpc.Response.Response != nil { - sc = result.oicpc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.oicpc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "ListByService", resp, "Failure sending request") - return - } - - result.oicpc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "ListByService", resp, "Failure responding to request") - return - } - if result.oicpc.hasNextLink() && result.oicpc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client OpenIDConnectProviderClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProviderClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProviderClient) ListByServiceResponder(resp *http.Response) (result OpenIDConnectProviderCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client OpenIDConnectProviderClient) listByServiceNextResults(ctx context.Context, lastResults OpenIDConnectProviderCollection) (result OpenIDConnectProviderCollection, err error) { - req, err := lastResults.openIDConnectProviderCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client OpenIDConnectProviderClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result OpenIDConnectProviderCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// ListSecrets gets the client secret details of the OpenID Connect Provider. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -func (client OpenIDConnectProviderClient) ListSecrets(ctx context.Context, resourceGroupName string, serviceName string, opid string) (result ClientSecretContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.ListSecrets") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "ListSecrets", err.Error()) - } - - req, err := client.ListSecretsPreparer(ctx, resourceGroupName, serviceName, opid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "ListSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.ListSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "ListSecrets", resp, "Failure sending request") - return - } - - result, err = client.ListSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "ListSecrets", resp, "Failure responding to request") - return - } - - return -} - -// ListSecretsPreparer prepares the ListSecrets request. -func (client OpenIDConnectProviderClient) ListSecretsPreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}/listSecrets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSecretsSender sends the ListSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProviderClient) ListSecretsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSecretsResponder handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProviderClient) ListSecretsResponder(resp *http.Response) (result ClientSecretContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates the specific OpenID Connect Provider. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client OpenIDConnectProviderClient) Update(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderUpdateContract, ifMatch string) (result OpenidConnectProviderContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, opid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client OpenIDConnectProviderClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProviderClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProviderClient) UpdateResponder(resp *http.Response) (result OpenidConnectProviderContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/operation.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/operation.go deleted file mode 100644 index bdd63958d917..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/operation.go +++ /dev/null @@ -1,194 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationClient is the apiManagement Client -type OperationClient struct { - BaseClient -} - -// NewOperationClient creates an instance of the OperationClient client. -func NewOperationClient(subscriptionID string) OperationClient { - return NewOperationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationClientWithBaseURI creates an instance of the OperationClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationClientWithBaseURI(baseURI string, subscriptionID string) OperationClient { - return OperationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByTags lists a collection of operations associated with tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| apiName | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -// includeNotTaggedOperations - include not tagged Operations. -func (client OperationClient) ListByTags(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, includeNotTaggedOperations *bool) (result TagResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationClient.ListByTags") - defer func() { - sc := -1 - if result.trc.Response.Response != nil { - sc = result.trc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.OperationClient", "ListByTags", err.Error()) - } - - result.fn = client.listByTagsNextResults - req, err := client.ListByTagsPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip, includeNotTaggedOperations) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OperationClient", "ListByTags", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTagsSender(req) - if err != nil { - result.trc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OperationClient", "ListByTags", resp, "Failure sending request") - return - } - - result.trc, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OperationClient", "ListByTags", resp, "Failure responding to request") - return - } - if result.trc.hasNextLink() && result.trc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTagsPreparer prepares the ListByTags request. -func (client OperationClient) ListByTagsPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, includeNotTaggedOperations *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if includeNotTaggedOperations != nil { - queryParameters["includeNotTaggedOperations"] = autorest.Encode("query", *includeNotTaggedOperations) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operationsByTags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTagsSender sends the ListByTags request. The method will close the -// http.Response Body if it receives an error. -func (client OperationClient) ListByTagsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTagsResponder handles the response to the ListByTags request. The method always -// closes the http.Response Body. -func (client OperationClient) ListByTagsResponder(resp *http.Response) (result TagResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTagsNextResults retrieves the next set of results, if any. -func (client OperationClient) listByTagsNextResults(ctx context.Context, lastResults TagResourceCollection) (result TagResourceCollection, err error) { - req, err := lastResults.tagResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.OperationClient", "listByTagsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.OperationClient", "listByTagsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OperationClient", "listByTagsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTagsComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationClient) ListByTagsComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, includeNotTaggedOperations *bool) (result TagResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationClient.ListByTags") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByTags(ctx, resourceGroupName, serviceName, apiid, filter, top, skip, includeNotTaggedOperations) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/operations.go deleted file mode 100644 index 2dc2392e75ee..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the apiManagement Client -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available REST API operations of the Microsoft.ApiManagement provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ApiManagement/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/outboundnetworkdependenciesendpoints.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/outboundnetworkdependenciesendpoints.go deleted file mode 100644 index ddf442b35fe8..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/outboundnetworkdependenciesendpoints.go +++ /dev/null @@ -1,118 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OutboundNetworkDependenciesEndpointsClient is the apiManagement Client -type OutboundNetworkDependenciesEndpointsClient struct { - BaseClient -} - -// NewOutboundNetworkDependenciesEndpointsClient creates an instance of the OutboundNetworkDependenciesEndpointsClient -// client. -func NewOutboundNetworkDependenciesEndpointsClient(subscriptionID string) OutboundNetworkDependenciesEndpointsClient { - return NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOutboundNetworkDependenciesEndpointsClientWithBaseURI creates an instance of the -// OutboundNetworkDependenciesEndpointsClient client using a custom endpoint. Use this when interacting with an Azure -// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(baseURI string, subscriptionID string) OutboundNetworkDependenciesEndpointsClient { - return OutboundNetworkDependenciesEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService gets the network endpoints of all outbound dependencies of a ApiManagement service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client OutboundNetworkDependenciesEndpointsClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result OutboundEnvironmentEndpointList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OutboundNetworkDependenciesEndpointsClient.ListByService") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.OutboundNetworkDependenciesEndpointsClient", "ListByService", err.Error()) - } - - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OutboundNetworkDependenciesEndpointsClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OutboundNetworkDependenciesEndpointsClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OutboundNetworkDependenciesEndpointsClient", "ListByService", resp, "Failure responding to request") - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client OutboundNetworkDependenciesEndpointsClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/outboundNetworkDependenciesEndpoints", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client OutboundNetworkDependenciesEndpointsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client OutboundNetworkDependenciesEndpointsClient) ListByServiceResponder(resp *http.Response) (result OutboundEnvironmentEndpointList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/policy.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/policy.go deleted file mode 100644 index 3417fe6f1adc..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/policy.go +++ /dev/null @@ -1,474 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PolicyClient is the apiManagement Client -type PolicyClient struct { - BaseClient -} - -// NewPolicyClient creates an instance of the PolicyClient client. -func NewPolicyClient(subscriptionID string) PolicyClient { - return NewPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPolicyClientWithBaseURI creates an instance of the PolicyClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewPolicyClientWithBaseURI(baseURI string, subscriptionID string) PolicyClient { - return PolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the global policy configuration of the Api Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - the policy contents to apply. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client PolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PolicyContract, ifMatch string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PolicyContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PolicyContractProperties.Value", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PolicyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PolicyContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PolicyClient) CreateOrUpdateResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the global policy configuration of the Api Management Service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client PolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PolicyClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PolicyClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the Global policy definition of the Api Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// formatParameter - policy Export Format. -func (client PolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, formatParameter PolicyExportFormat) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, formatParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PolicyClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, formatParameter PolicyExportFormat) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(formatParameter)) > 0 { - queryParameters["format"] = autorest.Encode("query", formatParameter) - } else { - queryParameters["format"] = autorest.Encode("query", "xml") - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PolicyClient) GetResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Global policy definition in the Api Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client PolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client PolicyClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client PolicyClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all the Global Policy definitions of the Api Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client PolicyClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result PolicyCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.ListByService") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyClient", "ListByService", err.Error()) - } - - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "ListByService", resp, "Failure responding to request") - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client PolicyClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client PolicyClient) ListByServiceResponder(resp *http.Response) (result PolicyCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/policydescription.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/policydescription.go deleted file mode 100644 index 7e93d11ac4b2..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/policydescription.go +++ /dev/null @@ -1,121 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PolicyDescriptionClient is the apiManagement Client -type PolicyDescriptionClient struct { - BaseClient -} - -// NewPolicyDescriptionClient creates an instance of the PolicyDescriptionClient client. -func NewPolicyDescriptionClient(subscriptionID string) PolicyDescriptionClient { - return NewPolicyDescriptionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPolicyDescriptionClientWithBaseURI creates an instance of the PolicyDescriptionClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPolicyDescriptionClientWithBaseURI(baseURI string, subscriptionID string) PolicyDescriptionClient { - return PolicyDescriptionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists all policy descriptions. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// scope - policy scope. -func (client PolicyDescriptionClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, scope PolicyScopeContract) (result PolicyDescriptionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyDescriptionClient.ListByService") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyDescriptionClient", "ListByService", err.Error()) - } - - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyDescriptionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PolicyDescriptionClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyDescriptionClient", "ListByService", resp, "Failure responding to request") - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client PolicyDescriptionClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, scope PolicyScopeContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(scope)) > 0 { - queryParameters["scope"] = autorest.Encode("query", scope) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyDescriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyDescriptionClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client PolicyDescriptionClient) ListByServiceResponder(resp *http.Response) (result PolicyDescriptionCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/portalrevision.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/portalrevision.go deleted file mode 100644 index 1956988bbfa9..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/portalrevision.go +++ /dev/null @@ -1,561 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PortalRevisionClient is the apiManagement Client -type PortalRevisionClient struct { - BaseClient -} - -// NewPortalRevisionClient creates an instance of the PortalRevisionClient client. -func NewPortalRevisionClient(subscriptionID string) PortalRevisionClient { - return NewPortalRevisionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPortalRevisionClientWithBaseURI creates an instance of the PortalRevisionClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewPortalRevisionClientWithBaseURI(baseURI string, subscriptionID string) PortalRevisionClient { - return PortalRevisionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new developer portal's revision by running the portal's publishing. The `isCurrent` -// property indicates if the revision is publicly accessible. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// portalRevisionID - portal revision identifier. Must be unique in the current API Management service -// instance. -func (client PortalRevisionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, portalRevisionID string, parameters PortalRevisionContract) (result PortalRevisionCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PortalRevisionClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: portalRevisionID, - Constraints: []validation.Constraint{{Target: "portalRevisionID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "portalRevisionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PortalRevisionContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PortalRevisionContractProperties.Description", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PortalRevisionContractProperties.Description", Name: validation.MaxLength, Rule: 2000, Chain: nil}}}, - {Target: "parameters.PortalRevisionContractProperties.StatusDetails", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PortalRevisionContractProperties.StatusDetails", Name: validation.MaxLength, Rule: 2000, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.PortalRevisionClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, portalRevisionID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PortalRevisionClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, portalRevisionID string, parameters PortalRevisionContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "portalRevisionId": autorest.Encode("path", portalRevisionID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PortalRevisionClient) CreateOrUpdateSender(req *http.Request) (future PortalRevisionCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PortalRevisionClient) CreateOrUpdateResponder(resp *http.Response) (result PortalRevisionContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the developer portal's revision specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// portalRevisionID - portal revision identifier. Must be unique in the current API Management service -// instance. -func (client PortalRevisionClient) Get(ctx context.Context, resourceGroupName string, serviceName string, portalRevisionID string) (result PortalRevisionContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PortalRevisionClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: portalRevisionID, - Constraints: []validation.Constraint{{Target: "portalRevisionID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "portalRevisionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PortalRevisionClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, portalRevisionID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PortalRevisionClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, portalRevisionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "portalRevisionId": autorest.Encode("path", portalRevisionID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PortalRevisionClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PortalRevisionClient) GetResponder(resp *http.Response) (result PortalRevisionContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the developer portal revision specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// portalRevisionID - portal revision identifier. Must be unique in the current API Management service -// instance. -func (client PortalRevisionClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, portalRevisionID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PortalRevisionClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: portalRevisionID, - Constraints: []validation.Constraint{{Target: "portalRevisionID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "portalRevisionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PortalRevisionClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, portalRevisionID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client PortalRevisionClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, portalRevisionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "portalRevisionId": autorest.Encode("path", portalRevisionID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client PortalRevisionClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client PortalRevisionClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists developer portal's revisions. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |isCurrent | eq, ne | | -// top - number of records to return. -// skip - number of records to skip. -func (client PortalRevisionClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result PortalRevisionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PortalRevisionClient.ListByService") - defer func() { - sc := -1 - if result.prc.Response.Response != nil { - sc = result.prc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.PortalRevisionClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.prc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "ListByService", resp, "Failure sending request") - return - } - - result.prc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "ListByService", resp, "Failure responding to request") - return - } - if result.prc.hasNextLink() && result.prc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client PortalRevisionClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client PortalRevisionClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client PortalRevisionClient) ListByServiceResponder(resp *http.Response) (result PortalRevisionCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client PortalRevisionClient) listByServiceNextResults(ctx context.Context, lastResults PortalRevisionCollection) (result PortalRevisionCollection, err error) { - req, err := lastResults.portalRevisionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client PortalRevisionClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result PortalRevisionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PortalRevisionClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates the description of specified portal revision or makes it current. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// portalRevisionID - portal revision identifier. Must be unique in the current API Management service -// instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client PortalRevisionClient) Update(ctx context.Context, resourceGroupName string, serviceName string, portalRevisionID string, parameters PortalRevisionContract, ifMatch string) (result PortalRevisionUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PortalRevisionClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: portalRevisionID, - Constraints: []validation.Constraint{{Target: "portalRevisionID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "portalRevisionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PortalRevisionClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, portalRevisionID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalRevisionClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PortalRevisionClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, portalRevisionID string, parameters PortalRevisionContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "portalRevisionId": autorest.Encode("path", portalRevisionID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client PortalRevisionClient) UpdateSender(req *http.Request) (future PortalRevisionUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client PortalRevisionClient) UpdateResponder(resp *http.Response) (result PortalRevisionContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/portalsettings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/portalsettings.go deleted file mode 100644 index 0c6e2c62dea2..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/portalsettings.go +++ /dev/null @@ -1,116 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PortalSettingsClient is the apiManagement Client -type PortalSettingsClient struct { - BaseClient -} - -// NewPortalSettingsClient creates an instance of the PortalSettingsClient client. -func NewPortalSettingsClient(subscriptionID string) PortalSettingsClient { - return NewPortalSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPortalSettingsClientWithBaseURI creates an instance of the PortalSettingsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewPortalSettingsClientWithBaseURI(baseURI string, subscriptionID string) PortalSettingsClient { - return PortalSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists a collection of portalsettings defined within a service instance.. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client PortalSettingsClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result PortalSettingsCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PortalSettingsClient.ListByService") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PortalSettingsClient", "ListByService", err.Error()) - } - - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalSettingsClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PortalSettingsClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PortalSettingsClient", "ListByService", resp, "Failure responding to request") - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client PortalSettingsClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client PortalSettingsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client PortalSettingsClient) ListByServiceResponder(resp *http.Response) (result PortalSettingsCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/privateendpointconnection.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/privateendpointconnection.go deleted file mode 100644 index af5fa715d5a2..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/privateendpointconnection.go +++ /dev/null @@ -1,552 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionClient is the apiManagement Client -type PrivateEndpointConnectionClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionClient creates an instance of the PrivateEndpointConnectionClient client. -func NewPrivateEndpointConnectionClient(subscriptionID string) PrivateEndpointConnectionClient { - return NewPrivateEndpointConnectionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionClientWithBaseURI creates an instance of the PrivateEndpointConnectionClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionClient { - return PrivateEndpointConnectionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Private Endpoint Connection or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// privateEndpointConnectionName - name of the private endpoint connection. -func (client PrivateEndpointConnectionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, privateEndpointConnectionName string, privateEndpointConnectionRequest PrivateEndpointConnectionRequest) (result PrivateEndpointConnectionCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PrivateEndpointConnectionClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, privateEndpointConnectionName, privateEndpointConnectionRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, privateEndpointConnectionName string, privateEndpointConnectionRequest PrivateEndpointConnectionRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(privateEndpointConnectionRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified Private Endpoint Connection. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// privateEndpointConnectionName - name of the private endpoint connection. -func (client PrivateEndpointConnectionClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PrivateEndpointConnectionClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetByName gets the details of the Private Endpoint Connection specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// privateEndpointConnectionName - name of the private endpoint connection. -func (client PrivateEndpointConnectionClient) GetByName(ctx context.Context, resourceGroupName string, serviceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.GetByName") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PrivateEndpointConnectionClient", "GetByName", err.Error()) - } - - req, err := client.GetByNamePreparer(ctx, resourceGroupName, serviceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "GetByName", nil, "Failure preparing request") - return - } - - resp, err := client.GetByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "GetByName", resp, "Failure sending request") - return - } - - result, err = client.GetByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "GetByName", resp, "Failure responding to request") - return - } - - return -} - -// GetByNamePreparer prepares the GetByName request. -func (client PrivateEndpointConnectionClient) GetByNamePreparer(ctx context.Context, resourceGroupName string, serviceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByNameSender sends the GetByName request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionClient) GetByNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByNameResponder handles the response to the GetByName request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionClient) GetByNameResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetPrivateLinkResource description for Gets the private link resources -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// privateLinkSubResourceName - name of the private link resource. -func (client PrivateEndpointConnectionClient) GetPrivateLinkResource(ctx context.Context, resourceGroupName string, serviceName string, privateLinkSubResourceName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.GetPrivateLinkResource") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PrivateEndpointConnectionClient", "GetPrivateLinkResource", err.Error()) - } - - req, err := client.GetPrivateLinkResourcePreparer(ctx, resourceGroupName, serviceName, privateLinkSubResourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "GetPrivateLinkResource", nil, "Failure preparing request") - return - } - - resp, err := client.GetPrivateLinkResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "GetPrivateLinkResource", resp, "Failure sending request") - return - } - - result, err = client.GetPrivateLinkResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "GetPrivateLinkResource", resp, "Failure responding to request") - return - } - - return -} - -// GetPrivateLinkResourcePreparer prepares the GetPrivateLinkResource request. -func (client PrivateEndpointConnectionClient) GetPrivateLinkResourcePreparer(ctx context.Context, resourceGroupName string, serviceName string, privateLinkSubResourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkSubResourceName": autorest.Encode("path", privateLinkSubResourceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources/{privateLinkSubResourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetPrivateLinkResourceSender sends the GetPrivateLinkResource request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionClient) GetPrivateLinkResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetPrivateLinkResourceResponder handles the response to the GetPrivateLinkResource request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionClient) GetPrivateLinkResourceResponder(resp *http.Response) (result PrivateLinkResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists all private endpoint connections of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client PrivateEndpointConnectionClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.ListByService") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PrivateEndpointConnectionClient", "ListByService", err.Error()) - } - - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "ListByService", resp, "Failure responding to request") - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client PrivateEndpointConnectionClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionClient) ListByServiceResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPrivateLinkResources description for Gets the private link resources -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client PrivateEndpointConnectionClient) ListPrivateLinkResources(ctx context.Context, resourceGroupName string, serviceName string) (result PrivateLinkResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.ListPrivateLinkResources") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PrivateEndpointConnectionClient", "ListPrivateLinkResources", err.Error()) - } - - req, err := client.ListPrivateLinkResourcesPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "ListPrivateLinkResources", nil, "Failure preparing request") - return - } - - resp, err := client.ListPrivateLinkResourcesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "ListPrivateLinkResources", resp, "Failure sending request") - return - } - - result, err = client.ListPrivateLinkResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PrivateEndpointConnectionClient", "ListPrivateLinkResources", resp, "Failure responding to request") - return - } - - return -} - -// ListPrivateLinkResourcesPreparer prepares the ListPrivateLinkResources request. -func (client PrivateEndpointConnectionClient) ListPrivateLinkResourcesPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListPrivateLinkResourcesSender sends the ListPrivateLinkResources request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionClient) ListPrivateLinkResourcesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListPrivateLinkResourcesResponder handles the response to the ListPrivateLinkResources request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionClient) ListPrivateLinkResourcesResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/product.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/product.go deleted file mode 100644 index 076a2db96bb3..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/product.go +++ /dev/null @@ -1,815 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ProductClient is the apiManagement Client -type ProductClient struct { - BaseClient -} - -// NewProductClient creates an instance of the ProductClient client. -func NewProductClient(subscriptionID string) ProductClient { - return NewProductClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductClientWithBaseURI creates an instance of the ProductClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewProductClientWithBaseURI(baseURI string, subscriptionID string) ProductClient { - return ProductClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client ProductClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters ProductContract, ifMatch string) (result ProductContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ProductContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ProductContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ProductContractProperties.DisplayName", Name: validation.MaxLength, Rule: 300, Chain: nil}, - {Target: "parameters.ProductContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, productID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProductClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters ProductContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ProductClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ProductClient) CreateOrUpdateResponder(resp *http.Response) (result ProductContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// deleteSubscriptions - delete existing subscriptions associated with the product or not. -func (client ProductClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string, deleteSubscriptions *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, productID, ifMatch, deleteSubscriptions) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string, deleteSubscriptions *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteSubscriptions != nil { - queryParameters["deleteSubscriptions"] = autorest.Encode("query", *deleteSubscriptions) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ProductClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ProductClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the product specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -func (client ProductClient) Get(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result ProductContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, productID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProductClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProductClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProductClient) GetResponder(resp *http.Response) (result ProductContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the product specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -func (client ProductClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, productID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client ProductClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client ProductClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client ProductClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of products in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| terms | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| state | filter | eq | |
| groups | expand | | |
-// top - number of records to return. -// skip - number of records to skip. -// expandGroups - when set to true, the response contains an array of groups that have visibility to the -// product. The default is false. -// tags - products which are part of a specific tag. -func (client ProductClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool, tags string) (result ProductCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.ListByService") - defer func() { - sc := -1 - if result.pc.Response.Response != nil { - sc = result.pc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip, expandGroups, tags) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.pc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByService", resp, "Failure sending request") - return - } - - result.pc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByService", resp, "Failure responding to request") - return - } - if result.pc.hasNextLink() && result.pc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client ProductClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool, tags string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if expandGroups != nil { - queryParameters["expandGroups"] = autorest.Encode("query", *expandGroups) - } - if len(tags) > 0 { - queryParameters["tags"] = autorest.Encode("query", tags) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client ProductClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client ProductClient) ListByServiceResponder(resp *http.Response) (result ProductCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client ProductClient) listByServiceNextResults(ctx context.Context, lastResults ProductCollection) (result ProductCollection, err error) { - req, err := lastResults.productCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool, tags string) (result ProductCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip, expandGroups, tags) - return -} - -// ListByTags lists a collection of products associated with tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| terms | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| state | filter | eq | substringof, contains, startswith, endswith -// |
-// top - number of records to return. -// skip - number of records to skip. -// includeNotTaggedProducts - include not tagged Products. -func (client ProductClient) ListByTags(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedProducts *bool) (result TagResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.ListByTags") - defer func() { - sc := -1 - if result.trc.Response.Response != nil { - sc = result.trc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "ListByTags", err.Error()) - } - - result.fn = client.listByTagsNextResults - req, err := client.ListByTagsPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, includeNotTaggedProducts) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByTags", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTagsSender(req) - if err != nil { - result.trc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByTags", resp, "Failure sending request") - return - } - - result.trc, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByTags", resp, "Failure responding to request") - return - } - if result.trc.hasNextLink() && result.trc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTagsPreparer prepares the ListByTags request. -func (client ProductClient) ListByTagsPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedProducts *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if includeNotTaggedProducts != nil { - queryParameters["includeNotTaggedProducts"] = autorest.Encode("query", *includeNotTaggedProducts) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/productsByTags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTagsSender sends the ListByTags request. The method will close the -// http.Response Body if it receives an error. -func (client ProductClient) ListByTagsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTagsResponder handles the response to the ListByTags request. The method always -// closes the http.Response Body. -func (client ProductClient) ListByTagsResponder(resp *http.Response) (result TagResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTagsNextResults retrieves the next set of results, if any. -func (client ProductClient) listByTagsNextResults(ctx context.Context, lastResults TagResourceCollection) (result TagResourceCollection, err error) { - req, err := lastResults.tagResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByTagsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByTagsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByTagsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTagsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductClient) ListByTagsComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedProducts *bool) (result TagResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.ListByTags") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByTags(ctx, resourceGroupName, serviceName, filter, top, skip, includeNotTaggedProducts) - return -} - -// Update update existing product details. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client ProductClient) Update(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters ProductUpdateParameters, ifMatch string) (result ProductContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, productID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ProductClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters ProductUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ProductClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ProductClient) UpdateResponder(resp *http.Response) (result ProductContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productapi.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productapi.go deleted file mode 100644 index dea0a5b0284b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productapi.go +++ /dev/null @@ -1,473 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ProductAPIClient is the apiManagement Client -type ProductAPIClient struct { - BaseClient -} - -// NewProductAPIClient creates an instance of the ProductAPIClient client. -func NewProductAPIClient(subscriptionID string) ProductAPIClient { - return NewProductAPIClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductAPIClientWithBaseURI creates an instance of the ProductAPIClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewProductAPIClientWithBaseURI(baseURI string, subscriptionID string) ProductAPIClient { - return ProductAPIClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckEntityExists checks that API entity specified by identifier is associated with the Product entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client ProductAPIClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductAPIClient.CheckEntityExists") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductAPIClient", "CheckEntityExists", err.Error()) - } - - req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, productID, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckEntityExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CheckEntityExists", resp, "Failure sending request") - return - } - - result, err = client.CheckEntityExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CheckEntityExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckEntityExistsPreparer prepares the CheckEntityExists request. -func (client ProductAPIClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the -// http.Response Body if it receives an error. -func (client ProductAPIClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (client ProductAPIClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate adds an API to the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client ProductAPIClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (result APIContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductAPIClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductAPIClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, productID, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProductAPIClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ProductAPIClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ProductAPIClient) CreateOrUpdateResponder(resp *http.Response) (result APIContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified API from the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client ProductAPIClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductAPIClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductAPIClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, productID, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductAPIClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ProductAPIClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ProductAPIClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByProduct lists a collection of the APIs associated with a product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| serviceUrl | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| path | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client ProductAPIClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result APICollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductAPIClient.ListByProduct") - defer func() { - sc := -1 - if result.ac.Response.Response != nil { - sc = result.ac.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductAPIClient", "ListByProduct", err.Error()) - } - - result.fn = client.listByProductNextResults - req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductSender(req) - if err != nil { - result.ac.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "ListByProduct", resp, "Failure sending request") - return - } - - result.ac, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "ListByProduct", resp, "Failure responding to request") - return - } - if result.ac.hasNextLink() && result.ac.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByProductPreparer prepares the ListByProduct request. -func (client ProductAPIClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProductSender sends the ListByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client ProductAPIClient) ListByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProductResponder handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (client ProductAPIClient) ListByProductResponder(resp *http.Response) (result APICollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByProductNextResults retrieves the next set of results, if any. -func (client ProductAPIClient) listByProductNextResults(ctx context.Context, lastResults APICollection) (result APICollection, err error) { - req, err := lastResults.aPICollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "listByProductNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "listByProductNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "listByProductNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByProductComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductAPIClient) ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result APICollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductAPIClient.ListByProduct") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByProduct(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productgroup.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productgroup.go deleted file mode 100644 index b1e6baecdb94..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productgroup.go +++ /dev/null @@ -1,463 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ProductGroupClient is the apiManagement Client -type ProductGroupClient struct { - BaseClient -} - -// NewProductGroupClient creates an instance of the ProductGroupClient client. -func NewProductGroupClient(subscriptionID string) ProductGroupClient { - return NewProductGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductGroupClientWithBaseURI creates an instance of the ProductGroupClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewProductGroupClientWithBaseURI(baseURI string, subscriptionID string) ProductGroupClient { - return ProductGroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckEntityExists checks that Group entity specified by identifier is associated with the Product entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// groupID - group identifier. Must be unique in the current API Management service instance. -func (client ProductGroupClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductGroupClient.CheckEntityExists") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductGroupClient", "CheckEntityExists", err.Error()) - } - - req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, productID, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckEntityExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CheckEntityExists", resp, "Failure sending request") - return - } - - result, err = client.CheckEntityExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CheckEntityExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckEntityExistsPreparer prepares the CheckEntityExists request. -func (client ProductGroupClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the -// http.Response Body if it receives an error. -func (client ProductGroupClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (client ProductGroupClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate adds the association between the specified developer group with the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// groupID - group identifier. Must be unique in the current API Management service instance. -func (client ProductGroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (result GroupContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductGroupClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductGroupClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, productID, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProductGroupClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ProductGroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ProductGroupClient) CreateOrUpdateResponder(resp *http.Response) (result GroupContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the association between the specified group and product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// groupID - group identifier. Must be unique in the current API Management service instance. -func (client ProductGroupClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductGroupClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductGroupClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, productID, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductGroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ProductGroupClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ProductGroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByProduct lists the collection of developer groups associated with the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | |
| displayName | filter | eq, ne | |
| description | filter | eq, ne | |
-// top - number of records to return. -// skip - number of records to skip. -func (client ProductGroupClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result GroupCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductGroupClient.ListByProduct") - defer func() { - sc := -1 - if result.gc.Response.Response != nil { - sc = result.gc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductGroupClient", "ListByProduct", err.Error()) - } - - result.fn = client.listByProductNextResults - req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductSender(req) - if err != nil { - result.gc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "ListByProduct", resp, "Failure sending request") - return - } - - result.gc, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "ListByProduct", resp, "Failure responding to request") - return - } - if result.gc.hasNextLink() && result.gc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByProductPreparer prepares the ListByProduct request. -func (client ProductGroupClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProductSender sends the ListByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client ProductGroupClient) ListByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProductResponder handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (client ProductGroupClient) ListByProductResponder(resp *http.Response) (result GroupCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByProductNextResults retrieves the next set of results, if any. -func (client ProductGroupClient) listByProductNextResults(ctx context.Context, lastResults GroupCollection) (result GroupCollection, err error) { - req, err := lastResults.groupCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "listByProductNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "listByProductNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "listByProductNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByProductComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductGroupClient) ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result GroupCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductGroupClient.ListByProduct") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByProduct(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productpolicy.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productpolicy.go deleted file mode 100644 index d31b2b80b3a6..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productpolicy.go +++ /dev/null @@ -1,499 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ProductPolicyClient is the apiManagement Client -type ProductPolicyClient struct { - BaseClient -} - -// NewProductPolicyClient creates an instance of the ProductPolicyClient client. -func NewProductPolicyClient(subscriptionID string) ProductPolicyClient { - return NewProductPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductPolicyClientWithBaseURI creates an instance of the ProductPolicyClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewProductPolicyClientWithBaseURI(baseURI string, subscriptionID string) ProductPolicyClient { - return ProductPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates policy configuration for the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// parameters - the policy contents to apply. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client ProductPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters PolicyContract, ifMatch string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PolicyContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PolicyContractProperties.Value", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductPolicyClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, productID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProductPolicyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters PolicyContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ProductPolicyClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ProductPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the policy configuration at the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client ProductPolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductPolicyClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, productID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductPolicyClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ProductPolicyClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ProductPolicyClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the policy configuration at the Product level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// formatParameter - policy Export Format. -func (client ProductPolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, productID string, formatParameter PolicyExportFormat) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductPolicyClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, productID, formatParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProductPolicyClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, formatParameter PolicyExportFormat) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(formatParameter)) > 0 { - queryParameters["format"] = autorest.Encode("query", formatParameter) - } else { - queryParameters["format"] = autorest.Encode("query", "xml") - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProductPolicyClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProductPolicyClient) GetResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag get the ETag of the policy configuration at the Product level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -func (client ProductPolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductPolicyClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, productID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client ProductPolicyClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client ProductPolicyClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client ProductPolicyClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByProduct get the policy configuration at the Product level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -func (client ProductPolicyClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result PolicyCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.ListByProduct") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductPolicyClient", "ListByProduct", err.Error()) - } - - req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, productID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "ListByProduct", resp, "Failure sending request") - return - } - - result, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "ListByProduct", resp, "Failure responding to request") - return - } - - return -} - -// ListByProductPreparer prepares the ListByProduct request. -func (client ProductPolicyClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProductSender sends the ListByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client ProductPolicyClient) ListByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProductResponder handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (client ProductPolicyClient) ListByProductResponder(resp *http.Response) (result PolicyCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productsubscriptions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productsubscriptions.go deleted file mode 100644 index 999471609f10..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/productsubscriptions.go +++ /dev/null @@ -1,190 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ProductSubscriptionsClient is the apiManagement Client -type ProductSubscriptionsClient struct { - BaseClient -} - -// NewProductSubscriptionsClient creates an instance of the ProductSubscriptionsClient client. -func NewProductSubscriptionsClient(subscriptionID string) ProductSubscriptionsClient { - return NewProductSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductSubscriptionsClientWithBaseURI creates an instance of the ProductSubscriptionsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewProductSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) ProductSubscriptionsClient { - return ProductSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the collection of subscriptions to the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| stateComment | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith |
| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith -// |
| state | filter | eq | |
| user | expand | | |
-// top - number of records to return. -// skip - number of records to skip. -func (client ProductSubscriptionsClient) List(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result SubscriptionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductSubscriptionsClient.List") - defer func() { - sc := -1 - if result.sc.Response.Response != nil { - sc = result.sc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductSubscriptionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "List", resp, "Failure sending request") - return - } - - result.sc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "List", resp, "Failure responding to request") - return - } - if result.sc.hasNextLink() && result.sc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ProductSubscriptionsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/subscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ProductSubscriptionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ProductSubscriptionsClient) ListResponder(resp *http.Response) (result SubscriptionCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ProductSubscriptionsClient) listNextResults(ctx context.Context, lastResults SubscriptionCollection) (result SubscriptionCollection, err error) { - req, err := lastResults.subscriptionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductSubscriptionsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result SubscriptionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductSubscriptionsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/quotabycounterkeys.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/quotabycounterkeys.go deleted file mode 100644 index c0966842e66c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/quotabycounterkeys.go +++ /dev/null @@ -1,216 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// QuotaByCounterKeysClient is the apiManagement Client -type QuotaByCounterKeysClient struct { - BaseClient -} - -// NewQuotaByCounterKeysClient creates an instance of the QuotaByCounterKeysClient client. -func NewQuotaByCounterKeysClient(subscriptionID string) QuotaByCounterKeysClient { - return NewQuotaByCounterKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewQuotaByCounterKeysClientWithBaseURI creates an instance of the QuotaByCounterKeysClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewQuotaByCounterKeysClientWithBaseURI(baseURI string, subscriptionID string) QuotaByCounterKeysClient { - return QuotaByCounterKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists a collection of current quota counter periods associated with the counter-key configured in the -// policy on the specified service instance. The api does not support paging yet. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// quotaCounterKey - quota counter key identifier.This is the result of expression defined in counter-key -// attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s -// accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible -// by "ba" key -func (client QuotaByCounterKeysClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string) (result QuotaCounterCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QuotaByCounterKeysClient.ListByService") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.QuotaByCounterKeysClient", "ListByService", err.Error()) - } - - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, quotaCounterKey) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService", resp, "Failure responding to request") - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client QuotaByCounterKeysClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client QuotaByCounterKeysClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client QuotaByCounterKeysClient) ListByServiceResponder(resp *http.Response) (result QuotaCounterCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates all the quota counter values specified with the existing quota counter key to a value in the -// specified service instance. This should be used for reset of the quota counter values. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// quotaCounterKey - quota counter key identifier.This is the result of expression defined in counter-key -// attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s -// accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible -// by "ba" key -// parameters - the value of the quota counter to be applied to all quota counter periods. -func (client QuotaByCounterKeysClient) Update(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, parameters QuotaCounterValueUpdateContract) (result QuotaCounterCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QuotaByCounterKeysClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.QuotaByCounterKeysClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, quotaCounterKey, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client QuotaByCounterKeysClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, parameters QuotaCounterValueUpdateContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client QuotaByCounterKeysClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client QuotaByCounterKeysClient) UpdateResponder(resp *http.Response) (result QuotaCounterCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/quotabyperiodkeys.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/quotabyperiodkeys.go deleted file mode 100644 index 0ea1fe9d93b4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/quotabyperiodkeys.go +++ /dev/null @@ -1,219 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// QuotaByPeriodKeysClient is the apiManagement Client -type QuotaByPeriodKeysClient struct { - BaseClient -} - -// NewQuotaByPeriodKeysClient creates an instance of the QuotaByPeriodKeysClient client. -func NewQuotaByPeriodKeysClient(subscriptionID string) QuotaByPeriodKeysClient { - return NewQuotaByPeriodKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewQuotaByPeriodKeysClientWithBaseURI creates an instance of the QuotaByPeriodKeysClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewQuotaByPeriodKeysClientWithBaseURI(baseURI string, subscriptionID string) QuotaByPeriodKeysClient { - return QuotaByPeriodKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the value of the quota counter associated with the counter-key in the policy for the specific period in -// service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// quotaCounterKey - quota counter key identifier.This is the result of expression defined in counter-key -// attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s -// accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible -// by "ba" key -// quotaPeriodKey - quota period key identifier. -func (client QuotaByPeriodKeysClient) Get(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string) (result QuotaCounterContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QuotaByPeriodKeysClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.QuotaByPeriodKeysClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client QuotaByPeriodKeysClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "quotaPeriodKey": autorest.Encode("path", quotaPeriodKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client QuotaByPeriodKeysClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client QuotaByPeriodKeysClient) GetResponder(resp *http.Response) (result QuotaCounterContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates an existing quota counter value in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// quotaCounterKey - quota counter key identifier.This is the result of expression defined in counter-key -// attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s -// accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible -// by "ba" key -// quotaPeriodKey - quota period key identifier. -// parameters - the value of the Quota counter to be applied on the specified period. -func (client QuotaByPeriodKeysClient) Update(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string, parameters QuotaCounterValueUpdateContract) (result QuotaCounterContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QuotaByPeriodKeysClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.QuotaByPeriodKeysClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client QuotaByPeriodKeysClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string, parameters QuotaCounterValueUpdateContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "quotaPeriodKey": autorest.Encode("path", quotaPeriodKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client QuotaByPeriodKeysClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client QuotaByPeriodKeysClient) UpdateResponder(resp *http.Response) (result QuotaCounterContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/region.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/region.go deleted file mode 100644 index 1fec0db5fc3a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/region.go +++ /dev/null @@ -1,158 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RegionClient is the apiManagement Client -type RegionClient struct { - BaseClient -} - -// NewRegionClient creates an instance of the RegionClient client. -func NewRegionClient(subscriptionID string) RegionClient { - return NewRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRegionClientWithBaseURI creates an instance of the RegionClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewRegionClientWithBaseURI(baseURI string, subscriptionID string) RegionClient { - return RegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists all azure regions in which the service exists. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client RegionClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result RegionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegionClient.ListByService") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.RegionClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.RegionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.RegionClient", "ListByService", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.RegionClient", "ListByService", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client RegionClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/regions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client RegionClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client RegionClient) ListByServiceResponder(resp *http.Response) (result RegionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client RegionClient) listByServiceNextResults(ctx context.Context, lastResults RegionListResult) (result RegionListResult, err error) { - req, err := lastResults.regionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.RegionClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.RegionClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.RegionClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegionClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string) (result RegionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegionClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/reports.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/reports.go deleted file mode 100644 index 6b93a897fb63..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/reports.go +++ /dev/null @@ -1,1220 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ReportsClient is the apiManagement Client -type ReportsClient struct { - BaseClient -} - -// NewReportsClient creates an instance of the ReportsClient client. -func NewReportsClient(subscriptionID string) ReportsClient { - return NewReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReportsClientWithBaseURI creates an instance of the ReportsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewReportsClientWithBaseURI(baseURI string, subscriptionID string) ReportsClient { - return ReportsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByAPI lists report records by API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - the filter to apply on the operation. -// top - number of records to return. -// skip - number of records to skip. -// orderby - oData order by query option. -func (client ReportsClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByAPI") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByAPI", err.Error()) - } - - result.fn = client.listByAPINextResults - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByAPI", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByAPI", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client ReportsClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byApi", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByAPIResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAPINextResults retrieves the next set of results, if any. -func (client ReportsClient) listByAPINextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByAPINextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByAPINextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByAPINextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAPIComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByAPI") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByAPI(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - return -} - -// ListByGeo lists report records by geography. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| timestamp | filter | ge, le | | -//
| country | select | | |
| region | select | | |
| zip | select | | | -//
| apiRegion | filter | eq | |
| userId | filter | eq | |
| productId | filter | eq | -// |
| subscriptionId | filter | eq | |
| apiId | filter | eq | |
| operationId | filter -// | eq | |
| callCountSuccess | select | | |
| callCountBlocked | select | | | -//
| callCountFailed | select | | |
| callCountOther | select | | |
| bandwidth -// | select, orderBy | | |
| cacheHitsCount | select | | |
| cacheMissCount | select -// | | |
| apiTimeAvg | select | | |
| apiTimeMin | select | | |
| -// apiTimeMax | select | | |
| serviceTimeAvg | select | | |
| serviceTimeMin | -// select | | |
| serviceTimeMax | select | | |
-// top - number of records to return. -// skip - number of records to skip. -func (client ReportsClient) ListByGeo(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByGeo") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByGeo", err.Error()) - } - - result.fn = client.listByGeoNextResults - req, err := client.ListByGeoPreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByGeo", nil, "Failure preparing request") - return - } - - resp, err := client.ListByGeoSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByGeo", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByGeoResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByGeo", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByGeoPreparer prepares the ListByGeo request. -func (client ReportsClient) ListByGeoPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byGeo", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByGeoSender sends the ListByGeo request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByGeoSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByGeoResponder handles the response to the ListByGeo request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByGeoResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByGeoNextResults retrieves the next set of results, if any. -func (client ReportsClient) listByGeoNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByGeoNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByGeoSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByGeoNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByGeoResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByGeoNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByGeoComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByGeoComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByGeo") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByGeo(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// ListByOperation lists report records by API Operations. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| timestamp | filter | ge, le | | -//
| displayName | select, orderBy | | |
| apiRegion | filter | eq | |
| userId | -// filter | eq | |
| productId | filter | eq | |
| subscriptionId | filter | eq | | -//
| apiId | filter | eq | |
| operationId | select, filter | eq | |
| callCountSuccess -// | select, orderBy | | |
| callCountBlocked | select, orderBy | | |
| -// callCountFailed | select, orderBy | | |
| callCountOther | select, orderBy | | |
| -// callCountTotal | select, orderBy | | |
| bandwidth | select, orderBy | | |
| -// cacheHitsCount | select | | |
| cacheMissCount | select | | |
| apiTimeAvg | -// select, orderBy | | |
| apiTimeMin | select | | |
| apiTimeMax | select | | -// |
| serviceTimeAvg | select | | |
| serviceTimeMin | select | | |
| -// serviceTimeMax | select | | |
-// top - number of records to return. -// skip - number of records to skip. -// orderby - oData order by query option. -func (client ReportsClient) ListByOperation(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByOperation") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByOperation", err.Error()) - } - - result.fn = client.listByOperationNextResults - req, err := client.ListByOperationPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByOperation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByOperationSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByOperation", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByOperation", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByOperationPreparer prepares the ListByOperation request. -func (client ReportsClient) ListByOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byOperation", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByOperationSender sends the ListByOperation request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByOperationResponder handles the response to the ListByOperation request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByOperationResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByOperationNextResults retrieves the next set of results, if any. -func (client ReportsClient) listByOperationNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByOperationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByOperationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByOperationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByOperationComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByOperationComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByOperation") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByOperation(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - return -} - -// ListByProduct lists report records by Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| timestamp | filter | ge, le | | -//
| displayName | select, orderBy | | |
| apiRegion | filter | eq | |
| userId | -// filter | eq | |
| productId | select, filter | eq | |
| subscriptionId | filter | eq | -// |
| callCountSuccess | select, orderBy | | |
| callCountBlocked | select, orderBy | | -// |
| callCountFailed | select, orderBy | | |
| callCountOther | select, orderBy | | -// |
| callCountTotal | select, orderBy | | |
| bandwidth | select, orderBy | | | -//
| cacheHitsCount | select | | |
| cacheMissCount | select | | |
| apiTimeAvg -// | select, orderBy | | |
| apiTimeMin | select | | |
| apiTimeMax | select | | -// |
| serviceTimeAvg | select | | |
| serviceTimeMin | select | | |
| -// serviceTimeMax | select | | |
-// top - number of records to return. -// skip - number of records to skip. -// orderby - oData order by query option. -func (client ReportsClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByProduct") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByProduct", err.Error()) - } - - result.fn = client.listByProductNextResults - req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByProduct", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByProduct", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByProductPreparer prepares the ListByProduct request. -func (client ReportsClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byProduct", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProductSender sends the ListByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProductResponder handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByProductResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByProductNextResults retrieves the next set of results, if any. -func (client ReportsClient) listByProductNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByProductNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByProductNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByProductNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByProductComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByProduct") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByProduct(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - return -} - -// ListByRequest lists report records by Request. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| timestamp | filter | ge, le | | -//
| apiId | filter | eq | |
| operationId | filter | eq | |
| productId | filter | eq | -// |
| userId | filter | eq | |
| apiRegion | filter | eq | |
| subscriptionId | filter -// | eq | |
-// top - number of records to return. -// skip - number of records to skip. -func (client ReportsClient) ListByRequest(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result RequestReportCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByRequest") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByRequest", err.Error()) - } - - req, err := client.ListByRequestPreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByRequest", nil, "Failure preparing request") - return - } - - resp, err := client.ListByRequestSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByRequest", resp, "Failure sending request") - return - } - - result, err = client.ListByRequestResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByRequest", resp, "Failure responding to request") - return - } - - return -} - -// ListByRequestPreparer prepares the ListByRequest request. -func (client ReportsClient) ListByRequestPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byRequest", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByRequestSender sends the ListByRequest request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByRequestSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByRequestResponder handles the response to the ListByRequest request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByRequestResponder(resp *http.Response) (result RequestReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription lists report records by subscription. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| timestamp | filter | ge, le | | -//
| displayName | select, orderBy | | |
| apiRegion | filter | eq | |
| userId | -// select, filter | eq | |
| productId | select, filter | eq | |
| subscriptionId | select, -// filter | eq | |
| callCountSuccess | select, orderBy | | |
| callCountBlocked | -// select, orderBy | | |
| callCountFailed | select, orderBy | | |
| callCountOther | -// select, orderBy | | |
| callCountTotal | select, orderBy | | |
| bandwidth | -// select, orderBy | | |
| cacheHitsCount | select | | |
| cacheMissCount | select | -// | |
| apiTimeAvg | select, orderBy | | |
| apiTimeMin | select | | |
| -// apiTimeMax | select | | |
| serviceTimeAvg | select | | |
| serviceTimeMin | -// select | | |
| serviceTimeMax | select | | |
-// top - number of records to return. -// skip - number of records to skip. -// orderby - oData order by query option. -func (client ReportsClient) ListBySubscription(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListBySubscription") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.rc, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ReportsClient) ListBySubscriptionPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/bySubscription", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListBySubscriptionResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client ReportsClient) listBySubscriptionNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListBySubscriptionComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - return -} - -// ListByTime lists report records by Time. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| timestamp | filter, select | ge, le | -// |
| interval | select | | |
| apiRegion | filter | eq | |
| userId | filter | eq -// | |
| productId | filter | eq | |
| subscriptionId | filter | eq | |
| apiId | -// filter | eq | |
| operationId | filter | eq | |
| callCountSuccess | select | | | -//
| callCountBlocked | select | | |
| callCountFailed | select | | |
| -// callCountOther | select | | |
| bandwidth | select, orderBy | | |
| cacheHitsCount -// | select | | |
| cacheMissCount | select | | |
| apiTimeAvg | select | | | -//
| apiTimeMin | select | | |
| apiTimeMax | select | | |
| serviceTimeAvg | -// select | | |
| serviceTimeMin | select | | |
| serviceTimeMax | select | | -// |
-// interval - by time interval. Interval must be multiple of 15 minutes and may not be zero. The value should -// be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert -// TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). -// top - number of records to return. -// skip - number of records to skip. -// orderby - oData order by query option. -func (client ReportsClient) ListByTime(ctx context.Context, resourceGroupName string, serviceName string, filter string, interval string, top *int32, skip *int32, orderby string) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByTime") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByTime", err.Error()) - } - - result.fn = client.listByTimeNextResults - req, err := client.ListByTimePreparer(ctx, resourceGroupName, serviceName, filter, interval, top, skip, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByTime", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTimeSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByTime", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByTimeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByTime", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTimePreparer prepares the ListByTime request. -func (client ReportsClient) ListByTimePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, interval string, top *int32, skip *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - "interval": autorest.Encode("query", interval), - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byTime", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTimeSender sends the ListByTime request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByTimeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTimeResponder handles the response to the ListByTime request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByTimeResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTimeNextResults retrieves the next set of results, if any. -func (client ReportsClient) listByTimeNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByTimeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTimeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByTimeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTimeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByTimeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTimeComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByTimeComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, interval string, top *int32, skip *int32, orderby string) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByTime") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByTime(ctx, resourceGroupName, serviceName, filter, interval, top, skip, orderby) - return -} - -// ListByUser lists report records by User. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| timestamp | filter | ge, le | | -//
| displayName | select, orderBy | | |
| userId | select, filter | eq | |
| -// apiRegion | filter | eq | |
| productId | filter | eq | |
| subscriptionId | filter | eq | -// |
| apiId | filter | eq | |
| operationId | filter | eq | |
| callCountSuccess | -// select, orderBy | | |
| callCountBlocked | select, orderBy | | |
| callCountFailed -// | select, orderBy | | |
| callCountOther | select, orderBy | | |
| callCountTotal -// | select, orderBy | | |
| bandwidth | select, orderBy | | |
| cacheHitsCount | -// select | | |
| cacheMissCount | select | | |
| apiTimeAvg | select, orderBy | -// | |
| apiTimeMin | select | | |
| apiTimeMax | select | | |
| -// serviceTimeAvg | select | | |
| serviceTimeMin | select | | |
| serviceTimeMax | -// select | | |
-// top - number of records to return. -// skip - number of records to skip. -// orderby - oData order by query option. -func (client ReportsClient) ListByUser(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByUser") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByUser", err.Error()) - } - - result.fn = client.listByUserNextResults - req, err := client.ListByUserPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByUser", nil, "Failure preparing request") - return - } - - resp, err := client.ListByUserSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByUser", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByUserResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByUser", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByUserPreparer prepares the ListByUser request. -func (client ReportsClient) ListByUserPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byUser", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByUserSender sends the ListByUser request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByUserSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByUserResponder handles the response to the ListByUser request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByUserResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByUserNextResults retrieves the next set of results, if any. -func (client ReportsClient) listByUserNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByUserNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByUserSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByUserNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByUserResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByUserNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByUserComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByUserComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByUser") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByUser(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/service.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/service.go deleted file mode 100644 index 506f5f9b9083..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/service.go +++ /dev/null @@ -1,1148 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServiceClient is the apiManagement Client -type ServiceClient struct { - BaseClient -} - -// NewServiceClient creates an instance of the ServiceClient client. -func NewServiceClient(subscriptionID string) ServiceClient { - return NewServiceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceClientWithBaseURI creates an instance of the ServiceClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewServiceClientWithBaseURI(baseURI string, subscriptionID string) ServiceClient { - return ServiceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ApplyNetworkConfigurationUpdates updates the Microsoft.ApiManagement resource running in the Virtual network to pick -// the updated DNS changes. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the Apply Network Configuration operation. If the parameters are empty, -// all the regions in which the Api Management service is deployed will be updated sequentially without -// incurring downtime in the region. -func (client ServiceClient) ApplyNetworkConfigurationUpdates(ctx context.Context, resourceGroupName string, serviceName string, parameters *ServiceApplyNetworkConfigurationParameters) (result ServiceApplyNetworkConfigurationUpdatesFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ApplyNetworkConfigurationUpdates") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "ApplyNetworkConfigurationUpdates", err.Error()) - } - - req, err := client.ApplyNetworkConfigurationUpdatesPreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "ApplyNetworkConfigurationUpdates", nil, "Failure preparing request") - return - } - - result, err = client.ApplyNetworkConfigurationUpdatesSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "ApplyNetworkConfigurationUpdates", result.Response(), "Failure sending request") - return - } - - return -} - -// ApplyNetworkConfigurationUpdatesPreparer prepares the ApplyNetworkConfigurationUpdates request. -func (client ServiceClient) ApplyNetworkConfigurationUpdatesPreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters *ServiceApplyNetworkConfigurationParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ApplyNetworkConfigurationUpdatesSender sends the ApplyNetworkConfigurationUpdates request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) ApplyNetworkConfigurationUpdatesSender(req *http.Request) (future ServiceApplyNetworkConfigurationUpdatesFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ApplyNetworkConfigurationUpdatesResponder handles the response to the ApplyNetworkConfigurationUpdates request. The method always -// closes the http.Response Body. -func (client ServiceClient) ApplyNetworkConfigurationUpdatesResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Backup creates a backup of the API Management service to the given Azure Storage Account. This is long running -// operation and could take several minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the ApiManagementService_Backup operation. -func (client ServiceClient) Backup(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters) (result ServiceBackupFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.Backup") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageAccount", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ContainerName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.BackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "Backup", err.Error()) - } - - req, err := client.BackupPreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Backup", nil, "Failure preparing request") - return - } - - result, err = client.BackupSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Backup", result.Response(), "Failure sending request") - return - } - - return -} - -// BackupPreparer prepares the Backup request. -func (client ServiceClient) BackupPreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// BackupSender sends the Backup request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) BackupSender(req *http.Request) (future ServiceBackupFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// BackupResponder handles the response to the Backup request. The method always -// closes the http.Response Body. -func (client ServiceClient) BackupResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CheckNameAvailability checks availability and correctness of a name for an API Management service. -// Parameters: -// parameters - parameters supplied to the CheckNameAvailability operation. -func (client ServiceClient) CheckNameAvailability(ctx context.Context, parameters ServiceCheckNameAvailabilityParameters) (result ServiceNameAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ServiceClient) CheckNameAvailabilityPreparer(ctx context.Context, parameters ServiceCheckNameAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client ServiceClient) CheckNameAvailabilityResponder(resp *http.Response) (result ServiceNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates an API Management service. This is long running operation and could take several -// minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the CreateOrUpdate API Management service operation. -func (client ServiceClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceResource) (result ServiceCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ServiceProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.PublisherEmail", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.PublisherEmail", Name: validation.MaxLength, Rule: 100, Chain: nil}}}, - {Target: "parameters.ServiceProperties.PublisherName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.PublisherName", Name: validation.MaxLength, Rule: 100, Chain: nil}}}, - }}, - {Target: "parameters.Sku", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Sku.Capacity", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServiceClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - parameters.Etag = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) CreateOrUpdateSender(req *http.Request) (future ServiceCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServiceClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing API Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client ServiceClient) Delete(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServiceClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) DeleteSender(req *http.Request) (future ServiceDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServiceClient) DeleteResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets an API Management service resource description. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client ServiceClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServiceClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServiceClient) GetResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDomainOwnershipIdentifier get the custom domain ownership identifier for an API Management service. -func (client ServiceClient) GetDomainOwnershipIdentifier(ctx context.Context) (result ServiceGetDomainOwnershipIdentifierResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.GetDomainOwnershipIdentifier") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetDomainOwnershipIdentifierPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "GetDomainOwnershipIdentifier", nil, "Failure preparing request") - return - } - - resp, err := client.GetDomainOwnershipIdentifierSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "GetDomainOwnershipIdentifier", resp, "Failure sending request") - return - } - - result, err = client.GetDomainOwnershipIdentifierResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "GetDomainOwnershipIdentifier", resp, "Failure responding to request") - return - } - - return -} - -// GetDomainOwnershipIdentifierPreparer prepares the GetDomainOwnershipIdentifier request. -func (client ServiceClient) GetDomainOwnershipIdentifierPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDomainOwnershipIdentifierSender sends the GetDomainOwnershipIdentifier request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) GetDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDomainOwnershipIdentifierResponder handles the response to the GetDomainOwnershipIdentifier request. The method always -// closes the http.Response Body. -func (client ServiceClient) GetDomainOwnershipIdentifierResponder(resp *http.Response) (result ServiceGetDomainOwnershipIdentifierResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSsoToken gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client ServiceClient) GetSsoToken(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceGetSsoTokenResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.GetSsoToken") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "GetSsoToken", err.Error()) - } - - req, err := client.GetSsoTokenPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "GetSsoToken", nil, "Failure preparing request") - return - } - - resp, err := client.GetSsoTokenSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "GetSsoToken", resp, "Failure sending request") - return - } - - result, err = client.GetSsoTokenResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "GetSsoToken", resp, "Failure responding to request") - return - } - - return -} - -// GetSsoTokenPreparer prepares the GetSsoToken request. -func (client ServiceClient) GetSsoTokenPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSsoTokenSender sends the GetSsoToken request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) GetSsoTokenSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSsoTokenResponder handles the response to the GetSsoToken request. The method always -// closes the http.Response Body. -func (client ServiceClient) GetSsoTokenResponder(resp *http.Response) (result ServiceGetSsoTokenResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all API Management services within an Azure subscription. -func (client ServiceClient) List(ctx context.Context) (result ServiceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.List") - defer func() { - sc := -1 - if result.slr.Response.Response != nil { - sc = result.slr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "List", resp, "Failure sending request") - return - } - - result.slr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "List", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServiceClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServiceClient) ListResponder(resp *http.Response) (result ServiceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ServiceClient) listNextResults(ctx context.Context, lastResults ServiceListResult) (result ServiceListResult, err error) { - req, err := lastResults.serviceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServiceClient) ListComplete(ctx context.Context) (result ServiceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup list all API Management services within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ServiceClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServiceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.slr.Response.Response != nil { - sc = result.slr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.slr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ServiceClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ServiceClient) ListByResourceGroupResponder(resp *http.Response) (result ServiceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ServiceClient) listByResourceGroupNextResults(ctx context.Context, lastResults ServiceListResult) (result ServiceListResult, err error) { - req, err := lastResults.serviceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServiceClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ServiceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// Restore restores a backup of an API Management service created using the ApiManagementService_Backup operation on -// the current service. This is a long running operation and could take several minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the Restore API Management service from backup operation. -func (client ServiceClient) Restore(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters) (result ServiceRestoreFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.Restore") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageAccount", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ContainerName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.BackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "Restore", err.Error()) - } - - req, err := client.RestorePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Restore", nil, "Failure preparing request") - return - } - - result, err = client.RestoreSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Restore", result.Response(), "Failure sending request") - return - } - - return -} - -// RestorePreparer prepares the Restore request. -func (client ServiceClient) RestorePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RestoreSender sends the Restore request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) RestoreSender(req *http.Request) (future ServiceRestoreFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RestoreResponder handles the response to the Restore request. The method always -// closes the http.Response Body. -func (client ServiceClient) RestoreResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates an existing API Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the CreateOrUpdate API Management service operation. -func (client ServiceClient) Update(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceUpdateParameters) (result ServiceUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServiceClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Etag = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) UpdateSender(req *http.Request) (future ServiceUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ServiceClient) UpdateResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/serviceskus.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/serviceskus.go deleted file mode 100644 index c7f75cb0ec58..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/serviceskus.go +++ /dev/null @@ -1,158 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServiceSkusClient is the apiManagement Client -type ServiceSkusClient struct { - BaseClient -} - -// NewServiceSkusClient creates an instance of the ServiceSkusClient client. -func NewServiceSkusClient(subscriptionID string) ServiceSkusClient { - return NewServiceSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceSkusClientWithBaseURI creates an instance of the ServiceSkusClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewServiceSkusClientWithBaseURI(baseURI string, subscriptionID string) ServiceSkusClient { - return ServiceSkusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListAvailableServiceSkus gets all available SKU for a given API Management service -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client ServiceSkusClient) ListAvailableServiceSkus(ctx context.Context, resourceGroupName string, serviceName string) (result ResourceSkuResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceSkusClient.ListAvailableServiceSkus") - defer func() { - sc := -1 - if result.rsr.Response.Response != nil { - sc = result.rsr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceSkusClient", "ListAvailableServiceSkus", err.Error()) - } - - result.fn = client.listAvailableServiceSkusNextResults - req, err := client.ListAvailableServiceSkusPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "ListAvailableServiceSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListAvailableServiceSkusSender(req) - if err != nil { - result.rsr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "ListAvailableServiceSkus", resp, "Failure sending request") - return - } - - result.rsr, err = client.ListAvailableServiceSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "ListAvailableServiceSkus", resp, "Failure responding to request") - return - } - if result.rsr.hasNextLink() && result.rsr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAvailableServiceSkusPreparer prepares the ListAvailableServiceSkus request. -func (client ServiceSkusClient) ListAvailableServiceSkusPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAvailableServiceSkusSender sends the ListAvailableServiceSkus request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceSkusClient) ListAvailableServiceSkusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAvailableServiceSkusResponder handles the response to the ListAvailableServiceSkus request. The method always -// closes the http.Response Body. -func (client ServiceSkusClient) ListAvailableServiceSkusResponder(resp *http.Response) (result ResourceSkuResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAvailableServiceSkusNextResults retrieves the next set of results, if any. -func (client ServiceSkusClient) listAvailableServiceSkusNextResults(ctx context.Context, lastResults ResourceSkuResults) (result ResourceSkuResults, err error) { - req, err := lastResults.resourceSkuResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "listAvailableServiceSkusNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAvailableServiceSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "listAvailableServiceSkusNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAvailableServiceSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "listAvailableServiceSkusNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAvailableServiceSkusComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServiceSkusClient) ListAvailableServiceSkusComplete(ctx context.Context, resourceGroupName string, serviceName string) (result ResourceSkuResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceSkusClient.ListAvailableServiceSkus") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAvailableServiceSkus(ctx, resourceGroupName, serviceName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/signinsettings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/signinsettings.go deleted file mode 100644 index d0d10bcfffbd..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/signinsettings.go +++ /dev/null @@ -1,380 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SignInSettingsClient is the apiManagement Client -type SignInSettingsClient struct { - BaseClient -} - -// NewSignInSettingsClient creates an instance of the SignInSettingsClient client. -func NewSignInSettingsClient(subscriptionID string) SignInSettingsClient { - return NewSignInSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSignInSettingsClientWithBaseURI creates an instance of the SignInSettingsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSignInSettingsClientWithBaseURI(baseURI string, subscriptionID string) SignInSettingsClient { - return SignInSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update Sign-In settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client SignInSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSigninSettings, ifMatch string) (result PortalSigninSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignInSettingsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignInSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SignInSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSigninSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SignInSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SignInSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result PortalSigninSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get Sign In Settings for the Portal -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client SignInSettingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result PortalSigninSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignInSettingsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignInSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SignInSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SignInSettingsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SignInSettingsClient) GetResponder(resp *http.Response) (result PortalSigninSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the SignInSettings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client SignInSettingsClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignInSettingsClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignInSettingsClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client SignInSettingsClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client SignInSettingsClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client SignInSettingsClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update update Sign-In settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - update Sign-In settings. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client SignInSettingsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSigninSettings, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignInSettingsClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignInSettingsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SignInSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSigninSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SignInSettingsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SignInSettingsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/signupsettings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/signupsettings.go deleted file mode 100644 index 69516f933d5e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/signupsettings.go +++ /dev/null @@ -1,380 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SignUpSettingsClient is the apiManagement Client -type SignUpSettingsClient struct { - BaseClient -} - -// NewSignUpSettingsClient creates an instance of the SignUpSettingsClient client. -func NewSignUpSettingsClient(subscriptionID string) SignUpSettingsClient { - return NewSignUpSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSignUpSettingsClientWithBaseURI creates an instance of the SignUpSettingsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSignUpSettingsClientWithBaseURI(baseURI string, subscriptionID string) SignUpSettingsClient { - return SignUpSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update Sign-Up settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client SignUpSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSignupSettings, ifMatch string) (result PortalSignupSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignUpSettingsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignUpSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SignUpSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSignupSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SignUpSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SignUpSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result PortalSignupSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get Sign Up Settings for the Portal -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client SignUpSettingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result PortalSignupSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignUpSettingsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignUpSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SignUpSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SignUpSettingsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SignUpSettingsClient) GetResponder(resp *http.Response) (result PortalSignupSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the SignUpSettings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client SignUpSettingsClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignUpSettingsClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignUpSettingsClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client SignUpSettingsClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client SignUpSettingsClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client SignUpSettingsClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update update Sign-Up settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - update Sign-Up settings. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client SignUpSettingsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSignupSettings, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignUpSettingsClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignUpSettingsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SignUpSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSignupSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SignUpSettingsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SignUpSettingsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/skus.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/skus.go deleted file mode 100644 index 9bdce92b9679..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/skus.go +++ /dev/null @@ -1,144 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SkusClient is the apiManagement Client -type SkusClient struct { - BaseClient -} - -// NewSkusClient creates an instance of the SkusClient client. -func NewSkusClient(subscriptionID string) SkusClient { - return NewSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSkusClientWithBaseURI creates an instance of the SkusClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSkusClientWithBaseURI(baseURI string, subscriptionID string) SkusClient { - return SkusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets the list of Microsoft.ApiManagement SKUs available for your Subscription. -func (client SkusClient) List(ctx context.Context) (result SkusResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SkusClient.List") - defer func() { - sc := -1 - if result.sr.Response.Response != nil { - sc = result.sr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SkusClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SkusClient", "List", resp, "Failure sending request") - return - } - - result.sr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SkusClient", "List", resp, "Failure responding to request") - return - } - if result.sr.hasNextLink() && result.sr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SkusClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SkusClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SkusClient) ListResponder(resp *http.Response) (result SkusResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client SkusClient) listNextResults(ctx context.Context, lastResults SkusResult) (result SkusResult, err error) { - req, err := lastResults.skusResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.SkusClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.SkusClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SkusClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SkusClient) ListComplete(ctx context.Context) (result SkusResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SkusClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/subscription.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/subscription.go deleted file mode 100644 index b06f60889e56..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/subscription.go +++ /dev/null @@ -1,959 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SubscriptionClient is the apiManagement Client -type SubscriptionClient struct { - BaseClient -} - -// NewSubscriptionClient creates an instance of the SubscriptionClient client. -func NewSubscriptionClient(subscriptionID string) SubscriptionClient { - return NewSubscriptionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubscriptionClientWithBaseURI creates an instance of the SubscriptionClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSubscriptionClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionClient { - return SubscriptionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the subscription of specified user to the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -// parameters - create parameters. -// notify - notify change in Subscription State. -// - If false, do not send any email notification for change of state of subscription -// - If true, send email notification of change of state of subscription -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -// appType - determines the type of application which send the create user request. Default is legacy publisher -// portal. -func (client SubscriptionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters SubscriptionCreateParameters, notify *bool, ifMatch string, appType AppType) (result SubscriptionContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SubscriptionCreateParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SubscriptionCreateParameterProperties.Scope", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.SubscriptionCreateParameterProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.SubscriptionCreateParameterProperties.DisplayName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "parameters.SubscriptionCreateParameterProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.SubscriptionCreateParameterProperties.PrimaryKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SubscriptionCreateParameterProperties.PrimaryKey", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "parameters.SubscriptionCreateParameterProperties.PrimaryKey", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.SubscriptionCreateParameterProperties.SecondaryKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SubscriptionCreateParameterProperties.SecondaryKey", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "parameters.SubscriptionCreateParameterProperties.SecondaryKey", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, sid, parameters, notify, ifMatch, appType) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SubscriptionClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters SubscriptionCreateParameters, notify *bool, ifMatch string, appType AppType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if notify != nil { - queryParameters["notify"] = autorest.Encode("query", *notify) - } - if len(string(appType)) > 0 { - queryParameters["appType"] = autorest.Encode("query", appType) - } else { - queryParameters["appType"] = autorest.Encode("query", "portal") - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) CreateOrUpdateResponder(resp *http.Response) (result SubscriptionContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified subscription. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client SubscriptionClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, sid string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, sid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SubscriptionClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified Subscription entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -func (client SubscriptionClient) Get(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result SubscriptionContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SubscriptionClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) GetResponder(resp *http.Response) (result SubscriptionContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -func (client SubscriptionClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client SubscriptionClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// List lists all subscriptions of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| stateComment | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith |
| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith -// |
| state | filter | eq | |
| user | expand | | |
-// top - number of records to return. -// skip - number of records to skip. -func (client SubscriptionClient) List(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result SubscriptionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.List") - defer func() { - sc := -1 - if result.sc.Response.Response != nil { - sc = result.sc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "List", resp, "Failure sending request") - return - } - - result.sc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "List", resp, "Failure responding to request") - return - } - if result.sc.hasNextLink() && result.sc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SubscriptionClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) ListResponder(resp *http.Response) (result SubscriptionCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client SubscriptionClient) listNextResults(ctx context.Context, lastResults SubscriptionCollection) (result SubscriptionCollection, err error) { - req, err := lastResults.subscriptionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SubscriptionClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result SubscriptionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// ListSecrets gets the specified Subscription keys. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -func (client SubscriptionClient) ListSecrets(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result SubscriptionKeysContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.ListSecrets") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "ListSecrets", err.Error()) - } - - req, err := client.ListSecretsPreparer(ctx, resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "ListSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.ListSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "ListSecrets", resp, "Failure sending request") - return - } - - result, err = client.ListSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "ListSecrets", resp, "Failure responding to request") - return - } - - return -} - -// ListSecretsPreparer prepares the ListSecrets request. -func (client SubscriptionClient) ListSecretsPreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/listSecrets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSecretsSender sends the ListSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) ListSecretsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSecretsResponder handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) ListSecretsResponder(resp *http.Response) (result SubscriptionKeysContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegeneratePrimaryKey regenerates primary key of existing subscription of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -func (client SubscriptionClient) RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.RegeneratePrimaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "RegeneratePrimaryKey", err.Error()) - } - - req, err := client.RegeneratePrimaryKeyPreparer(ctx, resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegeneratePrimaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegeneratePrimaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegeneratePrimaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegeneratePrimaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. -func (client SubscriptionClient) RegeneratePrimaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateSecondaryKey regenerates secondary key of existing subscription of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -func (client SubscriptionClient) RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.RegenerateSecondaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "RegenerateSecondaryKey", err.Error()) - } - - req, err := client.RegenerateSecondaryKeyPreparer(ctx, resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSecondaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegenerateSecondaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateSecondaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegenerateSecondaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. -func (client SubscriptionClient) RegenerateSecondaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) RegenerateSecondaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates the details of a subscription specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// notify - notify change in Subscription State. -// - If false, do not send any email notification for change of state of subscription -// - If true, send email notification of change of state of subscription -// appType - determines the type of application which send the create user request. Default is legacy publisher -// portal. -func (client SubscriptionClient) Update(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters SubscriptionUpdateParameters, ifMatch string, notify *bool, appType AppType) (result SubscriptionContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, sid, parameters, ifMatch, notify, appType) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SubscriptionClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters SubscriptionUpdateParameters, ifMatch string, notify *bool, appType AppType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if notify != nil { - queryParameters["notify"] = autorest.Encode("query", *notify) - } - if len(string(appType)) > 0 { - queryParameters["appType"] = autorest.Encode("query", appType) - } else { - queryParameters["appType"] = autorest.Encode("query", "portal") - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) UpdateResponder(resp *http.Response) (result SubscriptionContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tag.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tag.go deleted file mode 100644 index ba37f698e650..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tag.go +++ /dev/null @@ -1,2295 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// TagClient is the apiManagement Client -type TagClient struct { - BaseClient -} - -// NewTagClient creates an instance of the TagClient client. -func NewTagClient(subscriptionID string) TagClient { - return NewTagClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTagClientWithBaseURI creates an instance of the TagClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewTagClientWithBaseURI(baseURI string, subscriptionID string) TagClient { - return TagClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// AssignToAPI assign tag to the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) AssignToAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.AssignToAPI") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "AssignToAPI", err.Error()) - } - - req, err := client.AssignToAPIPreparer(ctx, resourceGroupName, serviceName, apiid, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToAPI", nil, "Failure preparing request") - return - } - - resp, err := client.AssignToAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToAPI", resp, "Failure sending request") - return - } - - result, err = client.AssignToAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToAPI", resp, "Failure responding to request") - return - } - - return -} - -// AssignToAPIPreparer prepares the AssignToAPI request. -func (client TagClient) AssignToAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AssignToAPISender sends the AssignToAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) AssignToAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// AssignToAPIResponder handles the response to the AssignToAPI request. The method always -// closes the http.Response Body. -func (client TagClient) AssignToAPIResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// AssignToOperation assign tag to the Operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) AssignToOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.AssignToOperation") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "AssignToOperation", err.Error()) - } - - req, err := client.AssignToOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToOperation", nil, "Failure preparing request") - return - } - - resp, err := client.AssignToOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToOperation", resp, "Failure sending request") - return - } - - result, err = client.AssignToOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToOperation", resp, "Failure responding to request") - return - } - - return -} - -// AssignToOperationPreparer prepares the AssignToOperation request. -func (client TagClient) AssignToOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AssignToOperationSender sends the AssignToOperation request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) AssignToOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// AssignToOperationResponder handles the response to the AssignToOperation request. The method always -// closes the http.Response Body. -func (client TagClient) AssignToOperationResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// AssignToProduct assign tag to the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) AssignToProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.AssignToProduct") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "AssignToProduct", err.Error()) - } - - req, err := client.AssignToProductPreparer(ctx, resourceGroupName, serviceName, productID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToProduct", nil, "Failure preparing request") - return - } - - resp, err := client.AssignToProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToProduct", resp, "Failure sending request") - return - } - - result, err = client.AssignToProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToProduct", resp, "Failure responding to request") - return - } - - return -} - -// AssignToProductPreparer prepares the AssignToProduct request. -func (client TagClient) AssignToProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AssignToProductSender sends the AssignToProduct request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) AssignToProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// AssignToProductResponder handles the response to the AssignToProduct request. The method always -// closes the http.Response Body. -func (client TagClient) AssignToProductResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates a tag. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// tagID - tag identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client TagClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters TagCreateUpdateParameters, ifMatch string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TagContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TagContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.TagContractProperties.DisplayName", Name: validation.MaxLength, Rule: 160, Chain: nil}, - {Target: "parameters.TagContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, tagID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TagClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters TagCreateUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client TagClient) CreateOrUpdateResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes specific tag of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// tagID - tag identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client TagClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, tagID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, tagID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TagClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, tagID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client TagClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DetachFromAPI detach the tag from the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) DetachFromAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.DetachFromAPI") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "DetachFromAPI", err.Error()) - } - - req, err := client.DetachFromAPIPreparer(ctx, resourceGroupName, serviceName, apiid, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromAPI", nil, "Failure preparing request") - return - } - - resp, err := client.DetachFromAPISender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromAPI", resp, "Failure sending request") - return - } - - result, err = client.DetachFromAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromAPI", resp, "Failure responding to request") - return - } - - return -} - -// DetachFromAPIPreparer prepares the DetachFromAPI request. -func (client TagClient) DetachFromAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DetachFromAPISender sends the DetachFromAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) DetachFromAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DetachFromAPIResponder handles the response to the DetachFromAPI request. The method always -// closes the http.Response Body. -func (client TagClient) DetachFromAPIResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DetachFromOperation detach the tag from the Operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) DetachFromOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.DetachFromOperation") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "DetachFromOperation", err.Error()) - } - - req, err := client.DetachFromOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromOperation", nil, "Failure preparing request") - return - } - - resp, err := client.DetachFromOperationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromOperation", resp, "Failure sending request") - return - } - - result, err = client.DetachFromOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromOperation", resp, "Failure responding to request") - return - } - - return -} - -// DetachFromOperationPreparer prepares the DetachFromOperation request. -func (client TagClient) DetachFromOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DetachFromOperationSender sends the DetachFromOperation request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) DetachFromOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DetachFromOperationResponder handles the response to the DetachFromOperation request. The method always -// closes the http.Response Body. -func (client TagClient) DetachFromOperationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DetachFromProduct detach the tag from the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) DetachFromProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.DetachFromProduct") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "DetachFromProduct", err.Error()) - } - - req, err := client.DetachFromProductPreparer(ctx, resourceGroupName, serviceName, productID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromProduct", nil, "Failure preparing request") - return - } - - resp, err := client.DetachFromProductSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromProduct", resp, "Failure sending request") - return - } - - result, err = client.DetachFromProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromProduct", resp, "Failure responding to request") - return - } - - return -} - -// DetachFromProductPreparer prepares the DetachFromProduct request. -func (client TagClient) DetachFromProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DetachFromProductSender sends the DetachFromProduct request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) DetachFromProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DetachFromProductResponder handles the response to the DetachFromProduct request. The method always -// closes the http.Response Body. -func (client TagClient) DetachFromProductResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) Get(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TagClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TagClient) GetResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByAPI get tag associated with the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetByAPI") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetByAPI", err.Error()) - } - - req, err := client.GetByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.GetByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByAPI", resp, "Failure sending request") - return - } - - result, err = client.GetByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByAPI", resp, "Failure responding to request") - return - } - - return -} - -// GetByAPIPreparer prepares the GetByAPI request. -func (client TagClient) GetByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByAPISender sends the GetByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByAPIResponder handles the response to the GetByAPI request. The method always -// closes the http.Response Body. -func (client TagClient) GetByAPIResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByOperation get tag associated with the Operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetByOperation") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetByOperation", err.Error()) - } - - req, err := client.GetByOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByOperation", nil, "Failure preparing request") - return - } - - resp, err := client.GetByOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByOperation", resp, "Failure sending request") - return - } - - result, err = client.GetByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByOperation", resp, "Failure responding to request") - return - } - - return -} - -// GetByOperationPreparer prepares the GetByOperation request. -func (client TagClient) GetByOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByOperationSender sends the GetByOperation request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetByOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByOperationResponder handles the response to the GetByOperation request. The method always -// closes the http.Response Body. -func (client TagClient) GetByOperationResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByProduct get tag associated with the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetByProduct") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetByProduct", err.Error()) - } - - req, err := client.GetByProductPreparer(ctx, resourceGroupName, serviceName, productID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.GetByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByProduct", resp, "Failure sending request") - return - } - - result, err = client.GetByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByProduct", resp, "Failure responding to request") - return - } - - return -} - -// GetByProductPreparer prepares the GetByProduct request. -func (client TagClient) GetByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByProductSender sends the GetByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByProductResponder handles the response to the GetByProduct request. The method always -// closes the http.Response Body. -func (client TagClient) GetByProductResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityState gets the entity state version of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetEntityState(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetEntityState") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetEntityState", err.Error()) - } - - req, err := client.GetEntityStatePreparer(ctx, resourceGroupName, serviceName, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityState", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityStateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityState", resp, "Failure sending request") - return - } - - result, err = client.GetEntityStateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityState", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityStatePreparer prepares the GetEntityState request. -func (client TagClient) GetEntityStatePreparer(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityStateSender sends the GetEntityState request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetEntityStateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityStateResponder handles the response to the GetEntityState request. The method always -// closes the http.Response Body. -func (client TagClient) GetEntityStateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetEntityStateByAPI gets the entity state version of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetEntityStateByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetEntityStateByAPI") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetEntityStateByAPI", err.Error()) - } - - req, err := client.GetEntityStateByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityStateByAPISender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByAPI", resp, "Failure sending request") - return - } - - result, err = client.GetEntityStateByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByAPI", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityStateByAPIPreparer prepares the GetEntityStateByAPI request. -func (client TagClient) GetEntityStateByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityStateByAPISender sends the GetEntityStateByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetEntityStateByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityStateByAPIResponder handles the response to the GetEntityStateByAPI request. The method always -// closes the http.Response Body. -func (client TagClient) GetEntityStateByAPIResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetEntityStateByOperation gets the entity state version of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetEntityStateByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetEntityStateByOperation") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetEntityStateByOperation", err.Error()) - } - - req, err := client.GetEntityStateByOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByOperation", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityStateByOperationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByOperation", resp, "Failure sending request") - return - } - - result, err = client.GetEntityStateByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByOperation", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityStateByOperationPreparer prepares the GetEntityStateByOperation request. -func (client TagClient) GetEntityStateByOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityStateByOperationSender sends the GetEntityStateByOperation request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetEntityStateByOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityStateByOperationResponder handles the response to the GetEntityStateByOperation request. The method always -// closes the http.Response Body. -func (client TagClient) GetEntityStateByOperationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetEntityStateByProduct gets the entity state version of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetEntityStateByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetEntityStateByProduct") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetEntityStateByProduct", err.Error()) - } - - req, err := client.GetEntityStateByProductPreparer(ctx, resourceGroupName, serviceName, productID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityStateByProductSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByProduct", resp, "Failure sending request") - return - } - - result, err = client.GetEntityStateByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByProduct", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityStateByProductPreparer prepares the GetEntityStateByProduct request. -func (client TagClient) GetEntityStateByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityStateByProductSender sends the GetEntityStateByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetEntityStateByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityStateByProductResponder handles the response to the GetEntityStateByProduct request. The method always -// closes the http.Response Body. -func (client TagClient) GetEntityStateByProductResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByAPI lists all Tags associated with the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| displayName | filter | ge, le, eq, ne, -// gt, lt | substringof, contains, startswith, endswith |
| name | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client TagClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result TagCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByAPI") - defer func() { - sc := -1 - if result.tc.Response.Response != nil { - sc = result.tc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "ListByAPI", err.Error()) - } - - result.fn = client.listByAPINextResults - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.tc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByAPI", resp, "Failure sending request") - return - } - - result.tc, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByAPI", resp, "Failure responding to request") - return - } - if result.tc.hasNextLink() && result.tc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client TagClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client TagClient) ListByAPIResponder(resp *http.Response) (result TagCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAPINextResults retrieves the next set of results, if any. -func (client TagClient) listByAPINextResults(ctx context.Context, lastResults TagCollection) (result TagCollection, err error) { - req, err := lastResults.tagCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByAPINextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByAPINextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByAPINextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAPIComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagClient) ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result TagCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByAPI") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByAPI(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} - -// ListByOperation lists all Tags associated with the Operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| displayName | filter | ge, le, eq, ne, -// gt, lt | substringof, contains, startswith, endswith |
| name | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client TagClient) ListByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, filter string, top *int32, skip *int32) (result TagCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByOperation") - defer func() { - sc := -1 - if result.tc.Response.Response != nil { - sc = result.tc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "ListByOperation", err.Error()) - } - - result.fn = client.listByOperationNextResults - req, err := client.ListByOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByOperation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByOperationSender(req) - if err != nil { - result.tc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByOperation", resp, "Failure sending request") - return - } - - result.tc, err = client.ListByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByOperation", resp, "Failure responding to request") - return - } - if result.tc.hasNextLink() && result.tc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByOperationPreparer prepares the ListByOperation request. -func (client TagClient) ListByOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByOperationSender sends the ListByOperation request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) ListByOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByOperationResponder handles the response to the ListByOperation request. The method always -// closes the http.Response Body. -func (client TagClient) ListByOperationResponder(resp *http.Response) (result TagCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByOperationNextResults retrieves the next set of results, if any. -func (client TagClient) listByOperationNextResults(ctx context.Context, lastResults TagCollection) (result TagCollection, err error) { - req, err := lastResults.tagCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByOperationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByOperationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByOperationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByOperationComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagClient) ListByOperationComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, filter string, top *int32, skip *int32) (result TagCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByOperation") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByOperation(ctx, resourceGroupName, serviceName, apiid, operationID, filter, top, skip) - return -} - -// ListByProduct lists all Tags associated with the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| displayName | filter | ge, le, eq, ne, -// gt, lt | substringof, contains, startswith, endswith |
| name | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client TagClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result TagCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByProduct") - defer func() { - sc := -1 - if result.tc.Response.Response != nil { - sc = result.tc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "ListByProduct", err.Error()) - } - - result.fn = client.listByProductNextResults - req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductSender(req) - if err != nil { - result.tc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByProduct", resp, "Failure sending request") - return - } - - result.tc, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByProduct", resp, "Failure responding to request") - return - } - if result.tc.hasNextLink() && result.tc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByProductPreparer prepares the ListByProduct request. -func (client TagClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProductSender sends the ListByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) ListByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProductResponder handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (client TagClient) ListByProductResponder(resp *http.Response) (result TagCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByProductNextResults retrieves the next set of results, if any. -func (client TagClient) listByProductNextResults(ctx context.Context, lastResults TagCollection) (result TagCollection, err error) { - req, err := lastResults.tagCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByProductNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByProductNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByProductNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByProductComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagClient) ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result TagCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByProduct") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByProduct(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - return -} - -// ListByService lists a collection of tags defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -// scope - scope like 'apis', 'products' or 'apis/{apiId} -func (client TagClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, scope string) (result TagCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByService") - defer func() { - sc := -1 - if result.tc.Response.Response != nil { - sc = result.tc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.tc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByService", resp, "Failure sending request") - return - } - - result.tc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByService", resp, "Failure responding to request") - return - } - if result.tc.hasNextLink() && result.tc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client TagClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, scope string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(scope) > 0 { - queryParameters["scope"] = autorest.Encode("query", scope) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client TagClient) ListByServiceResponder(resp *http.Response) (result TagCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client TagClient) listByServiceNextResults(ctx context.Context, lastResults TagCollection) (result TagCollection, err error) { - req, err := lastResults.tagCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, scope string) (result TagCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip, scope) - return -} - -// Update updates the details of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// tagID - tag identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client TagClient) Update(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters TagCreateUpdateParameters, ifMatch string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, tagID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TagClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters TagCreateUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client TagClient) UpdateResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tagresource.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tagresource.go deleted file mode 100644 index 16bb818bf8cf..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tagresource.go +++ /dev/null @@ -1,188 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// TagResourceClient is the apiManagement Client -type TagResourceClient struct { - BaseClient -} - -// NewTagResourceClient creates an instance of the TagResourceClient client. -func NewTagResourceClient(subscriptionID string) TagResourceClient { - return NewTagResourceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTagResourceClientWithBaseURI creates an instance of the TagResourceClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewTagResourceClientWithBaseURI(baseURI string, subscriptionID string) TagResourceClient { - return TagResourceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists a collection of resources associated with tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| aid | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| name | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith |
| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith -// |
| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| -// method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| urlTemplate | -// filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| terms | filter | ge, -// le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| state | filter | eq | |
| -// isCurrent | filter | eq | |
-// top - number of records to return. -// skip - number of records to skip. -func (client TagResourceClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result TagResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagResourceClient.ListByService") - defer func() { - sc := -1 - if result.trc.Response.Response != nil { - sc = result.trc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagResourceClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.trc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "ListByService", resp, "Failure sending request") - return - } - - result.trc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "ListByService", resp, "Failure responding to request") - return - } - if result.trc.hasNextLink() && result.trc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client TagResourceClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tagResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client TagResourceClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client TagResourceClient) ListByServiceResponder(resp *http.Response) (result TagResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client TagResourceClient) listByServiceNextResults(ctx context.Context, lastResults TagResourceCollection) (result TagResourceCollection, err error) { - req, err := lastResults.tagResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagResourceClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result TagResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagResourceClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantaccess.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantaccess.go deleted file mode 100644 index 148068883ce3..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantaccess.go +++ /dev/null @@ -1,773 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// TenantAccessClient is the apiManagement Client -type TenantAccessClient struct { - BaseClient -} - -// NewTenantAccessClient creates an instance of the TenantAccessClient client. -func NewTenantAccessClient(subscriptionID string) TenantAccessClient { - return NewTenantAccessClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantAccessClientWithBaseURI creates an instance of the TenantAccessClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewTenantAccessClientWithBaseURI(baseURI string, subscriptionID string) TenantAccessClient { - return TenantAccessClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create update tenant access information details. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to retrieve the Tenant Access Information. -// accessName - the identifier of the Access configuration. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client TenantAccessClient) Create(ctx context.Context, resourceGroupName string, serviceName string, parameters AccessInformationCreateParameters, accessName AccessIDName, ifMatch string) (result AccessInformationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, serviceName, parameters, accessName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TenantAccessClient) CreatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters AccessInformationCreateParameters, accessName AccessIDName, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", accessName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) CreateResponder(resp *http.Response) (result AccessInformationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get tenant access information details without secrets. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// accessName - the identifier of the Access configuration. -func (client TenantAccessClient) Get(ctx context.Context, resourceGroupName string, serviceName string, accessName AccessIDName) (result AccessInformationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, accessName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TenantAccessClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, accessName AccessIDName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", accessName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) GetResponder(resp *http.Response) (result AccessInformationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag tenant access metadata -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// accessName - the identifier of the Access configuration. -func (client TenantAccessClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, accessName AccessIDName) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, accessName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client TenantAccessClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, accessName AccessIDName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", accessName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService returns list of access infos - for Git and Management endpoints. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - not used -func (client TenantAccessClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string) (result AccessInformationCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.ListByService") - defer func() { - sc := -1 - if result.aic.Response.Response != nil { - sc = result.aic.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.aic.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "ListByService", resp, "Failure sending request") - return - } - - result.aic, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "ListByService", resp, "Failure responding to request") - return - } - if result.aic.hasNextLink() && result.aic.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client TenantAccessClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) ListByServiceResponder(resp *http.Response) (result AccessInformationCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client TenantAccessClient) listByServiceNextResults(ctx context.Context, lastResults AccessInformationCollection) (result AccessInformationCollection, err error) { - req, err := lastResults.accessInformationCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client TenantAccessClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string) (result AccessInformationCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter) - return -} - -// ListSecrets get tenant access information details. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// accessName - the identifier of the Access configuration. -func (client TenantAccessClient) ListSecrets(ctx context.Context, resourceGroupName string, serviceName string, accessName AccessIDName) (result AccessInformationSecretsContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.ListSecrets") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "ListSecrets", err.Error()) - } - - req, err := client.ListSecretsPreparer(ctx, resourceGroupName, serviceName, accessName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "ListSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.ListSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "ListSecrets", resp, "Failure sending request") - return - } - - result, err = client.ListSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "ListSecrets", resp, "Failure responding to request") - return - } - - return -} - -// ListSecretsPreparer prepares the ListSecrets request. -func (client TenantAccessClient) ListSecretsPreparer(ctx context.Context, resourceGroupName string, serviceName string, accessName AccessIDName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", accessName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/listSecrets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSecretsSender sends the ListSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) ListSecretsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSecretsResponder handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) ListSecretsResponder(resp *http.Response) (result AccessInformationSecretsContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegeneratePrimaryKey regenerate primary access key -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// accessName - the identifier of the Access configuration. -func (client TenantAccessClient) RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string, accessName AccessIDName) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.RegeneratePrimaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "RegeneratePrimaryKey", err.Error()) - } - - req, err := client.RegeneratePrimaryKeyPreparer(ctx, resourceGroupName, serviceName, accessName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegeneratePrimaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegeneratePrimaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. -func (client TenantAccessClient) RegeneratePrimaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string, accessName AccessIDName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", accessName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regeneratePrimaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateSecondaryKey regenerate secondary access key -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// accessName - the identifier of the Access configuration. -func (client TenantAccessClient) RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string, accessName AccessIDName) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.RegenerateSecondaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "RegenerateSecondaryKey", err.Error()) - } - - req, err := client.RegenerateSecondaryKeyPreparer(ctx, resourceGroupName, serviceName, accessName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSecondaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateSecondaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. -func (client TenantAccessClient) RegenerateSecondaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string, accessName AccessIDName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", accessName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regenerateSecondaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) RegenerateSecondaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update update tenant access information details. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to retrieve the Tenant Access Information. -// accessName - the identifier of the Access configuration. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client TenantAccessClient) Update(ctx context.Context, resourceGroupName string, serviceName string, parameters AccessInformationUpdateParameters, accessName AccessIDName, ifMatch string) (result AccessInformationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, parameters, accessName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TenantAccessClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters AccessInformationUpdateParameters, accessName AccessIDName, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", accessName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) UpdateResponder(resp *http.Response) (result AccessInformationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantaccessgit.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantaccessgit.go deleted file mode 100644 index 9da08261e4ea..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantaccessgit.go +++ /dev/null @@ -1,202 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// TenantAccessGitClient is the apiManagement Client -type TenantAccessGitClient struct { - BaseClient -} - -// NewTenantAccessGitClient creates an instance of the TenantAccessGitClient client. -func NewTenantAccessGitClient(subscriptionID string) TenantAccessGitClient { - return NewTenantAccessGitClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantAccessGitClientWithBaseURI creates an instance of the TenantAccessGitClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewTenantAccessGitClientWithBaseURI(baseURI string, subscriptionID string) TenantAccessGitClient { - return TenantAccessGitClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// RegeneratePrimaryKey regenerate primary access key for GIT. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// accessName - the identifier of the Access configuration. -func (client TenantAccessGitClient) RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string, accessName AccessIDName) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessGitClient.RegeneratePrimaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", err.Error()) - } - - req, err := client.RegeneratePrimaryKeyPreparer(ctx, resourceGroupName, serviceName, accessName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegeneratePrimaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegeneratePrimaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. -func (client TenantAccessGitClient) RegeneratePrimaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string, accessName AccessIDName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", accessName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regeneratePrimaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessGitClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessGitClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateSecondaryKey regenerate secondary access key for GIT. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// accessName - the identifier of the Access configuration. -func (client TenantAccessGitClient) RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string, accessName AccessIDName) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessGitClient.RegenerateSecondaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", err.Error()) - } - - req, err := client.RegenerateSecondaryKeyPreparer(ctx, resourceGroupName, serviceName, accessName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSecondaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateSecondaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. -func (client TenantAccessGitClient) RegenerateSecondaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string, accessName AccessIDName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", accessName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regenerateSecondaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessGitClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessGitClient) RegenerateSecondaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantconfiguration.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantconfiguration.go deleted file mode 100644 index b6de04f42e61..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantconfiguration.go +++ /dev/null @@ -1,404 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// TenantConfigurationClient is the apiManagement Client -type TenantConfigurationClient struct { - BaseClient -} - -// NewTenantConfigurationClient creates an instance of the TenantConfigurationClient client. -func NewTenantConfigurationClient(subscriptionID string) TenantConfigurationClient { - return NewTenantConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantConfigurationClientWithBaseURI creates an instance of the TenantConfigurationClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewTenantConfigurationClientWithBaseURI(baseURI string, subscriptionID string) TenantConfigurationClient { - return TenantConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Deploy this operation applies changes from the specified Git branch to the configuration database. This is a long -// running operation and could take several minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - deploy Configuration parameters. -func (client TenantConfigurationClient) Deploy(ctx context.Context, resourceGroupName string, serviceName string, parameters DeployConfigurationParameters) (result TenantConfigurationDeployFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationClient.Deploy") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DeployConfigurationParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DeployConfigurationParameterProperties.Branch", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantConfigurationClient", "Deploy", err.Error()) - } - - req, err := client.DeployPreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Deploy", nil, "Failure preparing request") - return - } - - result, err = client.DeploySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Deploy", result.Response(), "Failure sending request") - return - } - - return -} - -// DeployPreparer prepares the Deploy request. -func (client TenantConfigurationClient) DeployPreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters DeployConfigurationParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", "configuration"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeploySender sends the Deploy request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationClient) DeploySender(req *http.Request) (future TenantConfigurationDeployFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeployResponder handles the response to the Deploy request. The method always -// closes the http.Response Body. -func (client TenantConfigurationClient) DeployResponder(resp *http.Response) (result OperationResultContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSyncState gets the status of the most recent synchronization between the configuration database and the Git -// repository. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantConfigurationClient) GetSyncState(ctx context.Context, resourceGroupName string, serviceName string) (result TenantConfigurationSyncStateContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationClient.GetSyncState") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantConfigurationClient", "GetSyncState", err.Error()) - } - - req, err := client.GetSyncStatePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "GetSyncState", nil, "Failure preparing request") - return - } - - resp, err := client.GetSyncStateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "GetSyncState", resp, "Failure sending request") - return - } - - result, err = client.GetSyncStateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "GetSyncState", resp, "Failure responding to request") - return - } - - return -} - -// GetSyncStatePreparer prepares the GetSyncState request. -func (client TenantConfigurationClient) GetSyncStatePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", "configuration"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSyncStateSender sends the GetSyncState request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationClient) GetSyncStateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSyncStateResponder handles the response to the GetSyncState request. The method always -// closes the http.Response Body. -func (client TenantConfigurationClient) GetSyncStateResponder(resp *http.Response) (result TenantConfigurationSyncStateContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Save this operation creates a commit with the current configuration snapshot to the specified branch in the -// repository. This is a long running operation and could take several minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - save Configuration parameters. -func (client TenantConfigurationClient) Save(ctx context.Context, resourceGroupName string, serviceName string, parameters SaveConfigurationParameter) (result TenantConfigurationSaveFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationClient.Save") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SaveConfigurationParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SaveConfigurationParameterProperties.Branch", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantConfigurationClient", "Save", err.Error()) - } - - req, err := client.SavePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Save", nil, "Failure preparing request") - return - } - - result, err = client.SaveSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Save", result.Response(), "Failure sending request") - return - } - - return -} - -// SavePreparer prepares the Save request. -func (client TenantConfigurationClient) SavePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters SaveConfigurationParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", "configuration"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SaveSender sends the Save request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationClient) SaveSender(req *http.Request) (future TenantConfigurationSaveFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// SaveResponder handles the response to the Save request. The method always -// closes the http.Response Body. -func (client TenantConfigurationClient) SaveResponder(resp *http.Response) (result OperationResultContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Validate this operation validates the changes in the specified Git branch. This is a long running operation and -// could take several minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - validate Configuration parameters. -func (client TenantConfigurationClient) Validate(ctx context.Context, resourceGroupName string, serviceName string, parameters DeployConfigurationParameters) (result TenantConfigurationValidateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationClient.Validate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DeployConfigurationParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DeployConfigurationParameterProperties.Branch", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantConfigurationClient", "Validate", err.Error()) - } - - req, err := client.ValidatePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Validate", nil, "Failure preparing request") - return - } - - result, err = client.ValidateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Validate", result.Response(), "Failure sending request") - return - } - - return -} - -// ValidatePreparer prepares the Validate request. -func (client TenantConfigurationClient) ValidatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters DeployConfigurationParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", "configuration"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ValidateSender sends the Validate request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationClient) ValidateSender(req *http.Request) (future TenantConfigurationValidateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ValidateResponder handles the response to the Validate request. The method always -// closes the http.Response Body. -func (client TenantConfigurationClient) ValidateResponder(resp *http.Response) (result OperationResultContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantsettings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantsettings.go deleted file mode 100644 index 115f74b890fd..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/tenantsettings.go +++ /dev/null @@ -1,247 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// TenantSettingsClient is the apiManagement Client -type TenantSettingsClient struct { - BaseClient -} - -// NewTenantSettingsClient creates an instance of the TenantSettingsClient client. -func NewTenantSettingsClient(subscriptionID string) TenantSettingsClient { - return NewTenantSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantSettingsClientWithBaseURI creates an instance of the TenantSettingsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewTenantSettingsClientWithBaseURI(baseURI string, subscriptionID string) TenantSettingsClient { - return TenantSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get tenant settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantSettingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result TenantSettingsContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantSettingsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TenantSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "settingsType": autorest.Encode("path", "public"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings/{settingsType}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TenantSettingsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TenantSettingsClient) GetResponder(resp *http.Response) (result TenantSettingsContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService public settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - not used -func (client TenantSettingsClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string) (result TenantSettingsCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantSettingsClient.ListByService") - defer func() { - sc := -1 - if result.tsc.Response.Response != nil { - sc = result.tsc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantSettingsClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantSettingsClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.tsc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantSettingsClient", "ListByService", resp, "Failure sending request") - return - } - - result.tsc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantSettingsClient", "ListByService", resp, "Failure responding to request") - return - } - if result.tsc.hasNextLink() && result.tsc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client TenantSettingsClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client TenantSettingsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client TenantSettingsClient) ListByServiceResponder(resp *http.Response) (result TenantSettingsCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client TenantSettingsClient) listByServiceNextResults(ctx context.Context, lastResults TenantSettingsCollection) (result TenantSettingsCollection, err error) { - req, err := lastResults.tenantSettingsCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TenantSettingsClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TenantSettingsClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantSettingsClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client TenantSettingsClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string) (result TenantSettingsCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantSettingsClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/user.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/user.go deleted file mode 100644 index 82ceebdde2a1..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/user.go +++ /dev/null @@ -1,866 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// UserClient is the apiManagement Client -type UserClient struct { - BaseClient -} - -// NewUserClient creates an instance of the UserClient client. -func NewUserClient(subscriptionID string) UserClient { - return NewUserClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserClientWithBaseURI creates an instance of the UserClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewUserClientWithBaseURI(baseURI string, subscriptionID string) UserClient { - return UserClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a user. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// parameters - create or update parameters. -// notify - send an Email notification to the User. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client UserClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserCreateParameters, notify *bool, ifMatch string) (result UserContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.UserCreateParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.UserCreateParameterProperties.Email", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.UserCreateParameterProperties.Email", Name: validation.MaxLength, Rule: 254, Chain: nil}, - {Target: "parameters.UserCreateParameterProperties.Email", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.UserCreateParameterProperties.FirstName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.UserCreateParameterProperties.FirstName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "parameters.UserCreateParameterProperties.FirstName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.UserCreateParameterProperties.LastName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.UserCreateParameterProperties.LastName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "parameters.UserCreateParameterProperties.LastName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, userID, parameters, notify, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client UserClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserCreateParameters, notify *bool, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if notify != nil { - queryParameters["notify"] = autorest.Encode("query", *notify) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client UserClient) CreateOrUpdateResponder(resp *http.Response) (result UserContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes specific user. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// deleteSubscriptions - whether to delete user's subscription or not. -// notify - send an Account Closed Email notification to the User. -// appType - determines the type of application which send the create user request. Default is legacy publisher -// portal. -func (client UserClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, userID string, ifMatch string, deleteSubscriptions *bool, notify *bool, appType AppType) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, userID, ifMatch, deleteSubscriptions, notify, appType) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client UserClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, ifMatch string, deleteSubscriptions *bool, notify *bool, appType AppType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteSubscriptions != nil { - queryParameters["deleteSubscriptions"] = autorest.Encode("query", *deleteSubscriptions) - } - if notify != nil { - queryParameters["notify"] = autorest.Encode("query", *notify) - } - if len(string(appType)) > 0 { - queryParameters["appType"] = autorest.Encode("query", appType) - } else { - queryParameters["appType"] = autorest.Encode("query", "portal") - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client UserClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// GenerateSsoURL retrieves a redirection URL containing an authentication token for signing a given user into the -// developer portal. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client UserClient) GenerateSsoURL(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result GenerateSsoURLResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.GenerateSsoURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "GenerateSsoURL", err.Error()) - } - - req, err := client.GenerateSsoURLPreparer(ctx, resourceGroupName, serviceName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GenerateSsoURL", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateSsoURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GenerateSsoURL", resp, "Failure sending request") - return - } - - result, err = client.GenerateSsoURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GenerateSsoURL", resp, "Failure responding to request") - return - } - - return -} - -// GenerateSsoURLPreparer prepares the GenerateSsoURL request. -func (client UserClient) GenerateSsoURLPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/generateSsoUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateSsoURLSender sends the GenerateSsoURL request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) GenerateSsoURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GenerateSsoURLResponder handles the response to the GenerateSsoURL request. The method always -// closes the http.Response Body. -func (client UserClient) GenerateSsoURLResponder(resp *http.Response) (result GenerateSsoURLResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the details of the user specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client UserClient) Get(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result UserContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client UserClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client UserClient) GetResponder(resp *http.Response) (result UserContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the user specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client UserClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client UserClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client UserClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetSharedAccessToken gets the Shared Access Authorization Token for the User. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// parameters - create Authorization Token parameters. -func (client UserClient) GetSharedAccessToken(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserTokenParameters) (result UserTokenResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.GetSharedAccessToken") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.UserTokenParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.UserTokenParameterProperties.Expiry", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "GetSharedAccessToken", err.Error()) - } - - req, err := client.GetSharedAccessTokenPreparer(ctx, resourceGroupName, serviceName, userID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetSharedAccessToken", nil, "Failure preparing request") - return - } - - resp, err := client.GetSharedAccessTokenSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetSharedAccessToken", resp, "Failure sending request") - return - } - - result, err = client.GetSharedAccessTokenResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetSharedAccessToken", resp, "Failure responding to request") - return - } - - return -} - -// GetSharedAccessTokenPreparer prepares the GetSharedAccessToken request. -func (client UserClient) GetSharedAccessTokenPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserTokenParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/token", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSharedAccessTokenSender sends the GetSharedAccessToken request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) GetSharedAccessTokenSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSharedAccessTokenResponder handles the response to the GetSharedAccessToken request. The method always -// closes the http.Response Body. -func (client UserClient) GetSharedAccessTokenResponder(resp *http.Response) (result UserTokenResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of registered users in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| firstName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| lastName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| email | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| state | filter | eq | |
| registrationDate | filter | ge, le, -// eq, ne, gt, lt | |
| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith |
| groups | expand | | |
-// top - number of records to return. -// skip - number of records to skip. -// expandGroups - detailed Group in response. -func (client UserClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (result UserCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.ListByService") - defer func() { - sc := -1 - if result.uc.Response.Response != nil { - sc = result.uc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip, expandGroups) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.uc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "ListByService", resp, "Failure sending request") - return - } - - result.uc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "ListByService", resp, "Failure responding to request") - return - } - if result.uc.hasNextLink() && result.uc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client UserClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if expandGroups != nil { - queryParameters["expandGroups"] = autorest.Encode("query", *expandGroups) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client UserClient) ListByServiceResponder(resp *http.Response) (result UserCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client UserClient) listByServiceNextResults(ctx context.Context, lastResults UserCollection) (result UserCollection, err error) { - req, err := lastResults.userCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.UserClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.UserClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (result UserCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.ListByService") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip, expandGroups) - return -} - -// Update updates the details of the user specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client UserClient) Update(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserUpdateParameters, ifMatch string) (result UserContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, userID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client UserClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client UserClient) UpdateResponder(resp *http.Response) (result UserContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/userconfirmationpassword.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/userconfirmationpassword.go deleted file mode 100644 index 724fb628babc..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/userconfirmationpassword.go +++ /dev/null @@ -1,128 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// UserConfirmationPasswordClient is the apiManagement Client -type UserConfirmationPasswordClient struct { - BaseClient -} - -// NewUserConfirmationPasswordClient creates an instance of the UserConfirmationPasswordClient client. -func NewUserConfirmationPasswordClient(subscriptionID string) UserConfirmationPasswordClient { - return NewUserConfirmationPasswordClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserConfirmationPasswordClientWithBaseURI creates an instance of the UserConfirmationPasswordClient client using -// a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewUserConfirmationPasswordClientWithBaseURI(baseURI string, subscriptionID string) UserConfirmationPasswordClient { - return UserConfirmationPasswordClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// SendMethod sends confirmation -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// appType - determines the type of application which send the create user request. Default is legacy publisher -// portal. -func (client UserConfirmationPasswordClient) SendMethod(ctx context.Context, resourceGroupName string, serviceName string, userID string, appType AppType) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserConfirmationPasswordClient.SendMethod") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserConfirmationPasswordClient", "SendMethod", err.Error()) - } - - req, err := client.SendMethodPreparer(ctx, resourceGroupName, serviceName, userID, appType) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserConfirmationPasswordClient", "SendMethod", nil, "Failure preparing request") - return - } - - resp, err := client.SendMethodSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.UserConfirmationPasswordClient", "SendMethod", resp, "Failure sending request") - return - } - - result, err = client.SendMethodResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserConfirmationPasswordClient", "SendMethod", resp, "Failure responding to request") - return - } - - return -} - -// SendMethodPreparer prepares the SendMethod request. -func (client UserConfirmationPasswordClient) SendMethodPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, appType AppType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(appType)) > 0 { - queryParameters["appType"] = autorest.Encode("query", appType) - } else { - queryParameters["appType"] = autorest.Encode("query", "portal") - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/confirmations/password/send", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SendMethodSender sends the SendMethod request. The method will close the -// http.Response Body if it receives an error. -func (client UserConfirmationPasswordClient) SendMethodSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SendMethodResponder handles the response to the SendMethod request. The method always -// closes the http.Response Body. -func (client UserConfirmationPasswordClient) SendMethodResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/usergroup.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/usergroup.go deleted file mode 100644 index 05d724dab86d..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/usergroup.go +++ /dev/null @@ -1,185 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// UserGroupClient is the apiManagement Client -type UserGroupClient struct { - BaseClient -} - -// NewUserGroupClient creates an instance of the UserGroupClient client. -func NewUserGroupClient(subscriptionID string) UserGroupClient { - return NewUserGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserGroupClientWithBaseURI creates an instance of the UserGroupClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewUserGroupClientWithBaseURI(baseURI string, subscriptionID string) UserGroupClient { - return UserGroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all user groups. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|------------------------|-----------------------------------|
| name | filter | ge, -// le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, -// ne, gt, lt | substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, -// lt | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client UserGroupClient) List(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result GroupCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserGroupClient.List") - defer func() { - sc := -1 - if result.gc.Response.Response != nil { - sc = result.gc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.UserGroupClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, userID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.gc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "List", resp, "Failure sending request") - return - } - - result.gc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "List", resp, "Failure responding to request") - return - } - if result.gc.hasNextLink() && result.gc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UserGroupClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/groups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UserGroupClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UserGroupClient) ListResponder(resp *http.Response) (result GroupCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client UserGroupClient) listNextResults(ctx context.Context, lastResults GroupCollection) (result GroupCollection, err error) { - req, err := lastResults.groupCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserGroupClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result GroupCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserGroupClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, serviceName, userID, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/useridentities.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/useridentities.go deleted file mode 100644 index c081e563e770..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/useridentities.go +++ /dev/null @@ -1,163 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// UserIdentitiesClient is the apiManagement Client -type UserIdentitiesClient struct { - BaseClient -} - -// NewUserIdentitiesClient creates an instance of the UserIdentitiesClient client. -func NewUserIdentitiesClient(subscriptionID string) UserIdentitiesClient { - return NewUserIdentitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserIdentitiesClientWithBaseURI creates an instance of the UserIdentitiesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewUserIdentitiesClientWithBaseURI(baseURI string, subscriptionID string) UserIdentitiesClient { - return UserIdentitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list of all user identities. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client UserIdentitiesClient) List(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result UserIdentityCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserIdentitiesClient.List") - defer func() { - sc := -1 - if result.uic.Response.Response != nil { - sc = result.uic.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserIdentitiesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.uic.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "List", resp, "Failure sending request") - return - } - - result.uic, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "List", resp, "Failure responding to request") - return - } - if result.uic.hasNextLink() && result.uic.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UserIdentitiesClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/identities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UserIdentitiesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UserIdentitiesClient) ListResponder(resp *http.Response) (result UserIdentityCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client UserIdentitiesClient) listNextResults(ctx context.Context, lastResults UserIdentityCollection) (result UserIdentityCollection, err error) { - req, err := lastResults.userIdentityCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserIdentitiesClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result UserIdentityCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserIdentitiesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, serviceName, userID) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/usersubscription.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/usersubscription.go deleted file mode 100644 index 324db630264c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/usersubscription.go +++ /dev/null @@ -1,285 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// UserSubscriptionClient is the apiManagement Client -type UserSubscriptionClient struct { - BaseClient -} - -// NewUserSubscriptionClient creates an instance of the UserSubscriptionClient client. -func NewUserSubscriptionClient(subscriptionID string) UserSubscriptionClient { - return NewUserSubscriptionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserSubscriptionClientWithBaseURI creates an instance of the UserSubscriptionClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewUserSubscriptionClientWithBaseURI(baseURI string, subscriptionID string) UserSubscriptionClient { - return UserSubscriptionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the specified Subscription entity associated with a particular user. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -func (client UserSubscriptionClient) Get(ctx context.Context, resourceGroupName string, serviceName string, userID string, sid string) (result SubscriptionContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSubscriptionClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserSubscriptionClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, userID, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client UserSubscriptionClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions/{sid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client UserSubscriptionClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client UserSubscriptionClient) GetResponder(resp *http.Response) (result SubscriptionContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the collection of subscriptions of the specified user. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|------------------------|-----------------------------------|
|name | filter | ge, -// le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
|displayName | filter | ge, le, eq, -// ne, gt, lt | substringof, contains, startswith, endswith |
|stateComment | filter | ge, le, eq, ne, gt, -// lt | substringof, contains, startswith, endswith |
|ownerId | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
|scope | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
|userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
|productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client UserSubscriptionClient) List(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result SubscriptionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSubscriptionClient.List") - defer func() { - sc := -1 - if result.sc.Response.Response != nil { - sc = result.sc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.UserSubscriptionClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, userID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "List", resp, "Failure sending request") - return - } - - result.sc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "List", resp, "Failure responding to request") - return - } - if result.sc.hasNextLink() && result.sc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UserSubscriptionClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UserSubscriptionClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UserSubscriptionClient) ListResponder(resp *http.Response) (result SubscriptionCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client UserSubscriptionClient) listNextResults(ctx context.Context, lastResults SubscriptionCollection) (result SubscriptionCollection, err error) { - req, err := lastResults.subscriptionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserSubscriptionClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result SubscriptionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSubscriptionClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, serviceName, userID, filter, top, skip) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/version.go deleted file mode 100644 index 652c418003bc..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package apimanagement - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " apimanagement/2021-08-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/README.md new file mode 100644 index 000000000000..1092cf209f12 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/README.md @@ -0,0 +1,123 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api` Documentation + +The `api` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api" +``` + + +### Client Initialization + +```go +client := api.NewApiClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApiClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := api.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +payload := api.ApiCreateOrUpdateParameter{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload, api.DefaultCreateOrUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `ApiClient.Delete` + +```go +ctx := context.TODO() +id := api.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +read, err := client.Delete(ctx, id, api.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiClient.Get` + +```go +ctx := context.TODO() +id := api.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiClient.GetEntityTag` + +```go +ctx := context.TODO() +id := api.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiClient.ListByService` + +```go +ctx := context.TODO() +id := api.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, api.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, api.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ApiClient.Update` + +```go +ctx := context.TODO() +id := api.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +payload := api.ApiUpdateContract{ + // ... +} + + +read, err := client.Update(ctx, id, payload, api.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/client.go new file mode 100644 index 000000000000..5ce281961320 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/client.go @@ -0,0 +1,26 @@ +package api + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiClient struct { + Client *resourcemanager.Client +} + +func NewApiClientWithBaseURI(sdkApi sdkEnv.Api) (*ApiClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "api", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiClient: %+v", err) + } + + return &ApiClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/constants.go new file mode 100644 index 000000000000..63b7ebe8c1d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/constants.go @@ -0,0 +1,304 @@ +package api + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiType string + +const ( + ApiTypeGraphql ApiType = "graphql" + ApiTypeHTTP ApiType = "http" + ApiTypeSoap ApiType = "soap" + ApiTypeWebsocket ApiType = "websocket" +) + +func PossibleValuesForApiType() []string { + return []string{ + string(ApiTypeGraphql), + string(ApiTypeHTTP), + string(ApiTypeSoap), + string(ApiTypeWebsocket), + } +} + +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApiType(input string) (*ApiType, error) { + vals := map[string]ApiType{ + "graphql": ApiTypeGraphql, + "http": ApiTypeHTTP, + "soap": ApiTypeSoap, + "websocket": ApiTypeWebsocket, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApiType(input) + return &out, nil +} + +type BearerTokenSendingMethods string + +const ( + BearerTokenSendingMethodsAuthorizationHeader BearerTokenSendingMethods = "authorizationHeader" + BearerTokenSendingMethodsQuery BearerTokenSendingMethods = "query" +) + +func PossibleValuesForBearerTokenSendingMethods() []string { + return []string{ + string(BearerTokenSendingMethodsAuthorizationHeader), + string(BearerTokenSendingMethodsQuery), + } +} + +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { + vals := map[string]BearerTokenSendingMethods{ + "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, + "query": BearerTokenSendingMethodsQuery, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BearerTokenSendingMethods(input) + return &out, nil +} + +type ContentFormat string + +const ( + ContentFormatGraphqlNegativelink ContentFormat = "graphql-link" + ContentFormatOpenapi ContentFormat = "openapi" + ContentFormatOpenapiNegativelink ContentFormat = "openapi-link" + ContentFormatOpenapiPositivejson ContentFormat = "openapi+json" + ContentFormatOpenapiPositivejsonNegativelink ContentFormat = "openapi+json-link" + ContentFormatSwaggerNegativejson ContentFormat = "swagger-json" + ContentFormatSwaggerNegativelinkNegativejson ContentFormat = "swagger-link-json" + ContentFormatWadlNegativelinkNegativejson ContentFormat = "wadl-link-json" + ContentFormatWadlNegativexml ContentFormat = "wadl-xml" + ContentFormatWsdl ContentFormat = "wsdl" + ContentFormatWsdlNegativelink ContentFormat = "wsdl-link" +) + +func PossibleValuesForContentFormat() []string { + return []string{ + string(ContentFormatGraphqlNegativelink), + string(ContentFormatOpenapi), + string(ContentFormatOpenapiNegativelink), + string(ContentFormatOpenapiPositivejson), + string(ContentFormatOpenapiPositivejsonNegativelink), + string(ContentFormatSwaggerNegativejson), + string(ContentFormatSwaggerNegativelinkNegativejson), + string(ContentFormatWadlNegativelinkNegativejson), + string(ContentFormatWadlNegativexml), + string(ContentFormatWsdl), + string(ContentFormatWsdlNegativelink), + } +} + +func (s *ContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseContentFormat(input string) (*ContentFormat, error) { + vals := map[string]ContentFormat{ + "graphql-link": ContentFormatGraphqlNegativelink, + "openapi": ContentFormatOpenapi, + "openapi-link": ContentFormatOpenapiNegativelink, + "openapi+json": ContentFormatOpenapiPositivejson, + "openapi+json-link": ContentFormatOpenapiPositivejsonNegativelink, + "swagger-json": ContentFormatSwaggerNegativejson, + "swagger-link-json": ContentFormatSwaggerNegativelinkNegativejson, + "wadl-link-json": ContentFormatWadlNegativelinkNegativejson, + "wadl-xml": ContentFormatWadlNegativexml, + "wsdl": ContentFormatWsdl, + "wsdl-link": ContentFormatWsdlNegativelink, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContentFormat(input) + return &out, nil +} + +type Protocol string + +const ( + ProtocolHTTP Protocol = "http" + ProtocolHTTPS Protocol = "https" + ProtocolWs Protocol = "ws" + ProtocolWss Protocol = "wss" +) + +func PossibleValuesForProtocol() []string { + return []string{ + string(ProtocolHTTP), + string(ProtocolHTTPS), + string(ProtocolWs), + string(ProtocolWss), + } +} + +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocol(input string) (*Protocol, error) { + vals := map[string]Protocol{ + "http": ProtocolHTTP, + "https": ProtocolHTTPS, + "ws": ProtocolWs, + "wss": ProtocolWss, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Protocol(input) + return &out, nil +} + +type SoapApiType string + +const ( + SoapApiTypeGraphql SoapApiType = "graphql" + SoapApiTypeHTTP SoapApiType = "http" + SoapApiTypeSoap SoapApiType = "soap" + SoapApiTypeWebsocket SoapApiType = "websocket" +) + +func PossibleValuesForSoapApiType() []string { + return []string{ + string(SoapApiTypeGraphql), + string(SoapApiTypeHTTP), + string(SoapApiTypeSoap), + string(SoapApiTypeWebsocket), + } +} + +func (s *SoapApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSoapApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSoapApiType(input string) (*SoapApiType, error) { + vals := map[string]SoapApiType{ + "graphql": SoapApiTypeGraphql, + "http": SoapApiTypeHTTP, + "soap": SoapApiTypeSoap, + "websocket": SoapApiTypeWebsocket, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SoapApiType(input) + return &out, nil +} + +type VersioningScheme string + +const ( + VersioningSchemeHeader VersioningScheme = "Header" + VersioningSchemeQuery VersioningScheme = "Query" + VersioningSchemeSegment VersioningScheme = "Segment" +) + +func PossibleValuesForVersioningScheme() []string { + return []string{ + string(VersioningSchemeHeader), + string(VersioningSchemeQuery), + string(VersioningSchemeSegment), + } +} + +func (s *VersioningScheme) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVersioningScheme(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVersioningScheme(input string) (*VersioningScheme, error) { + vals := map[string]VersioningScheme{ + "header": VersioningSchemeHeader, + "query": VersioningSchemeQuery, + "segment": VersioningSchemeSegment, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VersioningScheme(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/id_api.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/id_api.go new file mode 100644 index 000000000000..b76a03a3ca43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/id_api.go @@ -0,0 +1,140 @@ +package api + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApiId{} + +// ApiId is a struct representing the Resource ID for a Api +type ApiId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string +} + +// NewApiID returns a new ApiId struct +func NewApiID(subscriptionId string, resourceGroupName string, serviceName string, apiId string) ApiId { + return ApiId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + } +} + +// ParseApiID parses 'input' into a ApiId +func ParseApiID(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ParseApiIDInsensitively parses 'input' case-insensitively into a ApiId +// note: this method should only be used for API response data and not user input +func ParseApiIDInsensitively(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ValidateApiID checks that 'input' can be parsed as a Api ID +func ValidateApiID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApiID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api ID +func (id ApiId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api ID +func (id ApiId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + } +} + +// String returns a human-readable description of this Api ID +func (id ApiId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + } + return fmt.Sprintf("Api (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/id_service.go new file mode 100644 index 000000000000..c8e90bbf8044 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/id_service.go @@ -0,0 +1,127 @@ +package api + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_createorupdate.go new file mode 100644 index 000000000000..6906b67a6baa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_createorupdate.go @@ -0,0 +1,103 @@ +package api + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiClient) CreateOrUpdate(ctx context.Context, id ApiId, input ApiCreateOrUpdateParameter, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ApiClient) CreateOrUpdateThenPoll(ctx context.Context, id ApiId, input ApiCreateOrUpdateParameter, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_delete.go new file mode 100644 index 000000000000..19f24f35d166 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_delete.go @@ -0,0 +1,79 @@ +package api + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + DeleteRevisions *bool + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.DeleteRevisions != nil { + out.Append("deleteRevisions", fmt.Sprintf("%v", *o.DeleteRevisions)) + } + return &out +} + +// Delete ... +func (c ApiClient) Delete(ctx context.Context, id ApiId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_get.go new file mode 100644 index 000000000000..f750fb8e0ec4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_get.go @@ -0,0 +1,51 @@ +package api + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiContract +} + +// Get ... +func (c ApiClient) Get(ctx context.Context, id ApiId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_getentitytag.go new file mode 100644 index 000000000000..5d65ab7fc887 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_getentitytag.go @@ -0,0 +1,46 @@ +package api + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiClient) GetEntityTag(ctx context.Context, id ApiId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_listbyservice.go new file mode 100644 index 000000000000..2b6a6ad37f76 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_listbyservice.go @@ -0,0 +1,133 @@ +package api + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiContract +} + +type ListByServiceCompleteResult struct { + Items []ApiContract +} + +type ListByServiceOperationOptions struct { + ExpandApiVersionSet *bool + Filter *string + Skip *int64 + Tags *string + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ExpandApiVersionSet != nil { + out.Append("expandApiVersionSet", fmt.Sprintf("%v", *o.ExpandApiVersionSet)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Tags != nil { + out.Append("tags", fmt.Sprintf("%v", *o.Tags)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/apis", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate ApiContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ApiContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_update.go new file mode 100644 index 000000000000..8b2e6fa43576 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/method_update.go @@ -0,0 +1,84 @@ +package api + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiClient) Update(ctx context.Context, id ApiId, input ApiUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontactinformation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontactinformation.go new file mode 100644 index 000000000000..18f05550be7f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontactinformation.go @@ -0,0 +1,10 @@ +package api + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiContactInformation struct { + Email *string `json:"email,omitempty"` + Name *string `json:"name,omitempty"` + Url *string `json:"url,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontract.go new file mode 100644 index 000000000000..27bc06fcbfc7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontract.go @@ -0,0 +1,11 @@ +package api + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ApiContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontractproperties.go new file mode 100644 index 000000000000..642bf4735e2f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontractproperties.go @@ -0,0 +1,28 @@ +package api + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiContractProperties struct { + ApiRevision *string `json:"apiRevision,omitempty"` + ApiRevisionDescription *string `json:"apiRevisionDescription,omitempty"` + ApiVersion *string `json:"apiVersion,omitempty"` + ApiVersionDescription *string `json:"apiVersionDescription,omitempty"` + ApiVersionSet *ApiVersionSetContractDetails `json:"apiVersionSet,omitempty"` + ApiVersionSetId *string `json:"apiVersionSetId,omitempty"` + AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` + Contact *ApiContactInformation `json:"contact,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + IsCurrent *bool `json:"isCurrent,omitempty"` + IsOnline *bool `json:"isOnline,omitempty"` + License *ApiLicenseInformation `json:"license,omitempty"` + Path string `json:"path"` + Protocols *[]Protocol `json:"protocols,omitempty"` + ServiceUrl *string `json:"serviceUrl,omitempty"` + SourceApiId *string `json:"sourceApiId,omitempty"` + SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` + SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` + TermsOfServiceUrl *string `json:"termsOfServiceUrl,omitempty"` + Type *ApiType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontractupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontractupdateproperties.go new file mode 100644 index 000000000000..fe0189ae8826 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicontractupdateproperties.go @@ -0,0 +1,26 @@ +package api + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiContractUpdateProperties struct { + ApiRevision *string `json:"apiRevision,omitempty"` + ApiRevisionDescription *string `json:"apiRevisionDescription,omitempty"` + ApiVersion *string `json:"apiVersion,omitempty"` + ApiVersionDescription *string `json:"apiVersionDescription,omitempty"` + ApiVersionSetId *string `json:"apiVersionSetId,omitempty"` + AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` + Contact *ApiContactInformation `json:"contact,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + IsCurrent *bool `json:"isCurrent,omitempty"` + IsOnline *bool `json:"isOnline,omitempty"` + License *ApiLicenseInformation `json:"license,omitempty"` + Path *string `json:"path,omitempty"` + Protocols *[]Protocol `json:"protocols,omitempty"` + ServiceUrl *string `json:"serviceUrl,omitempty"` + SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` + SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` + TermsOfServiceUrl *string `json:"termsOfServiceUrl,omitempty"` + Type *ApiType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicreateorupdateparameter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicreateorupdateparameter.go new file mode 100644 index 000000000000..827cef00b3d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicreateorupdateparameter.go @@ -0,0 +1,8 @@ +package api + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiCreateOrUpdateParameter struct { + Properties *ApiCreateOrUpdateProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicreateorupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicreateorupdateproperties.go new file mode 100644 index 000000000000..27eb255570e2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicreateorupdateproperties.go @@ -0,0 +1,32 @@ +package api + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiCreateOrUpdateProperties struct { + ApiRevision *string `json:"apiRevision,omitempty"` + ApiRevisionDescription *string `json:"apiRevisionDescription,omitempty"` + ApiType *SoapApiType `json:"apiType,omitempty"` + ApiVersion *string `json:"apiVersion,omitempty"` + ApiVersionDescription *string `json:"apiVersionDescription,omitempty"` + ApiVersionSet *ApiVersionSetContractDetails `json:"apiVersionSet,omitempty"` + ApiVersionSetId *string `json:"apiVersionSetId,omitempty"` + AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` + Contact *ApiContactInformation `json:"contact,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Format *ContentFormat `json:"format,omitempty"` + IsCurrent *bool `json:"isCurrent,omitempty"` + IsOnline *bool `json:"isOnline,omitempty"` + License *ApiLicenseInformation `json:"license,omitempty"` + Path string `json:"path"` + Protocols *[]Protocol `json:"protocols,omitempty"` + ServiceUrl *string `json:"serviceUrl,omitempty"` + SourceApiId *string `json:"sourceApiId,omitempty"` + SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` + SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` + TermsOfServiceUrl *string `json:"termsOfServiceUrl,omitempty"` + Type *ApiType `json:"type,omitempty"` + Value *string `json:"value,omitempty"` + WsdlSelector *ApiCreateOrUpdatePropertiesWsdlSelector `json:"wsdlSelector,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicreateorupdatepropertieswsdlselector.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicreateorupdatepropertieswsdlselector.go new file mode 100644 index 000000000000..bf784d037059 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apicreateorupdatepropertieswsdlselector.go @@ -0,0 +1,9 @@ +package api + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiCreateOrUpdatePropertiesWsdlSelector struct { + WsdlEndpointName *string `json:"wsdlEndpointName,omitempty"` + WsdlServiceName *string `json:"wsdlServiceName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apilicenseinformation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apilicenseinformation.go new file mode 100644 index 000000000000..73fa0cfd9a9f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apilicenseinformation.go @@ -0,0 +1,9 @@ +package api + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiLicenseInformation struct { + Name *string `json:"name,omitempty"` + Url *string `json:"url,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apiupdatecontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apiupdatecontract.go new file mode 100644 index 000000000000..a6d5dabf58a3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apiupdatecontract.go @@ -0,0 +1,8 @@ +package api + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiUpdateContract struct { + Properties *ApiContractUpdateProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apiversionsetcontractdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apiversionsetcontractdetails.go new file mode 100644 index 000000000000..35b7f1f5294c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_apiversionsetcontractdetails.go @@ -0,0 +1,13 @@ +package api + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiVersionSetContractDetails struct { + Description *string `json:"description,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + VersionHeaderName *string `json:"versionHeaderName,omitempty"` + VersionQueryName *string `json:"versionQueryName,omitempty"` + VersioningScheme *VersioningScheme `json:"versioningScheme,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_authenticationsettingscontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_authenticationsettingscontract.go new file mode 100644 index 000000000000..10d964921e55 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_authenticationsettingscontract.go @@ -0,0 +1,9 @@ +package api + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthenticationSettingsContract struct { + OAuth2 *OAuth2AuthenticationSettingsContract `json:"oAuth2,omitempty"` + Openid *OpenIdAuthenticationSettingsContract `json:"openid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_oauth2authenticationsettingscontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_oauth2authenticationsettingscontract.go new file mode 100644 index 000000000000..9aa0dda0317a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_oauth2authenticationsettingscontract.go @@ -0,0 +1,9 @@ +package api + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OAuth2AuthenticationSettingsContract struct { + AuthorizationServerId *string `json:"authorizationServerId,omitempty"` + Scope *string `json:"scope,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_openidauthenticationsettingscontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_openidauthenticationsettingscontract.go new file mode 100644 index 000000000000..2cd5f005f83f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_openidauthenticationsettingscontract.go @@ -0,0 +1,9 @@ +package api + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OpenIdAuthenticationSettingsContract struct { + BearerTokenSendingMethods *[]BearerTokenSendingMethods `json:"bearerTokenSendingMethods,omitempty"` + OpenidProviderId *string `json:"openidProviderId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_subscriptionkeyparameternamescontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_subscriptionkeyparameternamescontract.go new file mode 100644 index 000000000000..f8315aaa8682 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/model_subscriptionkeyparameternamescontract.go @@ -0,0 +1,9 @@ +package api + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionKeyParameterNamesContract struct { + Header *string `json:"header,omitempty"` + Query *string `json:"query,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/predicates.go new file mode 100644 index 000000000000..780e16ccd7f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/predicates.go @@ -0,0 +1,27 @@ +package api + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ApiContractOperationPredicate) Matches(input ApiContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/version.go new file mode 100644 index 000000000000..122b66804663 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api/version.go @@ -0,0 +1,12 @@ +package api + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/api/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/README.md new file mode 100644 index 000000000000..412b5d1e43c2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic` Documentation + +The `apidiagnostic` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic" +``` + + +### Client Initialization + +```go +client := apidiagnostic.NewApiDiagnosticClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApiDiagnosticClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := apidiagnostic.NewApiDiagnosticID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "diagnosticIdValue") + +payload := apidiagnostic.DiagnosticContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, apidiagnostic.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiDiagnosticClient.Delete` + +```go +ctx := context.TODO() +id := apidiagnostic.NewApiDiagnosticID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "diagnosticIdValue") + +read, err := client.Delete(ctx, id, apidiagnostic.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiDiagnosticClient.Get` + +```go +ctx := context.TODO() +id := apidiagnostic.NewApiDiagnosticID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "diagnosticIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiDiagnosticClient.GetEntityTag` + +```go +ctx := context.TODO() +id := apidiagnostic.NewApiDiagnosticID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "diagnosticIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiDiagnosticClient.ListByService` + +```go +ctx := context.TODO() +id := apidiagnostic.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +// alternatively `client.ListByService(ctx, id, apidiagnostic.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, apidiagnostic.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ApiDiagnosticClient.Update` + +```go +ctx := context.TODO() +id := apidiagnostic.NewApiDiagnosticID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "diagnosticIdValue") + +payload := apidiagnostic.DiagnosticContract{ + // ... +} + + +read, err := client.Update(ctx, id, payload, apidiagnostic.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/client.go new file mode 100644 index 000000000000..10bdb8741b23 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/client.go @@ -0,0 +1,26 @@ +package apidiagnostic + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiDiagnosticClient struct { + Client *resourcemanager.Client +} + +func NewApiDiagnosticClientWithBaseURI(sdkApi sdkEnv.Api) (*ApiDiagnosticClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "apidiagnostic", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiDiagnosticClient: %+v", err) + } + + return &ApiDiagnosticClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/constants.go new file mode 100644 index 000000000000..1afde676ffaa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/constants.go @@ -0,0 +1,256 @@ +package apidiagnostic + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AlwaysLog string + +const ( + AlwaysLogAllErrors AlwaysLog = "allErrors" +) + +func PossibleValuesForAlwaysLog() []string { + return []string{ + string(AlwaysLogAllErrors), + } +} + +func (s *AlwaysLog) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAlwaysLog(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAlwaysLog(input string) (*AlwaysLog, error) { + vals := map[string]AlwaysLog{ + "allerrors": AlwaysLogAllErrors, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AlwaysLog(input) + return &out, nil +} + +type DataMaskingMode string + +const ( + DataMaskingModeHide DataMaskingMode = "Hide" + DataMaskingModeMask DataMaskingMode = "Mask" +) + +func PossibleValuesForDataMaskingMode() []string { + return []string{ + string(DataMaskingModeHide), + string(DataMaskingModeMask), + } +} + +func (s *DataMaskingMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDataMaskingMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDataMaskingMode(input string) (*DataMaskingMode, error) { + vals := map[string]DataMaskingMode{ + "hide": DataMaskingModeHide, + "mask": DataMaskingModeMask, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DataMaskingMode(input) + return &out, nil +} + +type HTTPCorrelationProtocol string + +const ( + HTTPCorrelationProtocolLegacy HTTPCorrelationProtocol = "Legacy" + HTTPCorrelationProtocolNone HTTPCorrelationProtocol = "None" + HTTPCorrelationProtocolWThreeC HTTPCorrelationProtocol = "W3C" +) + +func PossibleValuesForHTTPCorrelationProtocol() []string { + return []string{ + string(HTTPCorrelationProtocolLegacy), + string(HTTPCorrelationProtocolNone), + string(HTTPCorrelationProtocolWThreeC), + } +} + +func (s *HTTPCorrelationProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHTTPCorrelationProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHTTPCorrelationProtocol(input string) (*HTTPCorrelationProtocol, error) { + vals := map[string]HTTPCorrelationProtocol{ + "legacy": HTTPCorrelationProtocolLegacy, + "none": HTTPCorrelationProtocolNone, + "w3c": HTTPCorrelationProtocolWThreeC, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HTTPCorrelationProtocol(input) + return &out, nil +} + +type OperationNameFormat string + +const ( + OperationNameFormatName OperationNameFormat = "Name" + OperationNameFormatUrl OperationNameFormat = "Url" +) + +func PossibleValuesForOperationNameFormat() []string { + return []string{ + string(OperationNameFormatName), + string(OperationNameFormatUrl), + } +} + +func (s *OperationNameFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperationNameFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperationNameFormat(input string) (*OperationNameFormat, error) { + vals := map[string]OperationNameFormat{ + "name": OperationNameFormatName, + "url": OperationNameFormatUrl, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperationNameFormat(input) + return &out, nil +} + +type SamplingType string + +const ( + SamplingTypeFixed SamplingType = "fixed" +) + +func PossibleValuesForSamplingType() []string { + return []string{ + string(SamplingTypeFixed), + } +} + +func (s *SamplingType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSamplingType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSamplingType(input string) (*SamplingType, error) { + vals := map[string]SamplingType{ + "fixed": SamplingTypeFixed, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SamplingType(input) + return &out, nil +} + +type Verbosity string + +const ( + VerbosityError Verbosity = "error" + VerbosityInformation Verbosity = "information" + VerbosityVerbose Verbosity = "verbose" +) + +func PossibleValuesForVerbosity() []string { + return []string{ + string(VerbosityError), + string(VerbosityInformation), + string(VerbosityVerbose), + } +} + +func (s *Verbosity) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVerbosity(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVerbosity(input string) (*Verbosity, error) { + vals := map[string]Verbosity{ + "error": VerbosityError, + "information": VerbosityInformation, + "verbose": VerbosityVerbose, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Verbosity(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_api.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_api.go new file mode 100644 index 000000000000..458b69d35bb0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_api.go @@ -0,0 +1,140 @@ +package apidiagnostic + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApiId{} + +// ApiId is a struct representing the Resource ID for a Api +type ApiId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string +} + +// NewApiID returns a new ApiId struct +func NewApiID(subscriptionId string, resourceGroupName string, serviceName string, apiId string) ApiId { + return ApiId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + } +} + +// ParseApiID parses 'input' into a ApiId +func ParseApiID(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ParseApiIDInsensitively parses 'input' case-insensitively into a ApiId +// note: this method should only be used for API response data and not user input +func ParseApiIDInsensitively(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ValidateApiID checks that 'input' can be parsed as a Api ID +func ValidateApiID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApiID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api ID +func (id ApiId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api ID +func (id ApiId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + } +} + +// String returns a human-readable description of this Api ID +func (id ApiId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + } + return fmt.Sprintf("Api (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_apidiagnostic.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_apidiagnostic.go new file mode 100644 index 000000000000..c2dc08baea88 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_apidiagnostic.go @@ -0,0 +1,153 @@ +package apidiagnostic + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApiDiagnosticId{} + +// ApiDiagnosticId is a struct representing the Resource ID for a Api Diagnostic +type ApiDiagnosticId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string + DiagnosticId string +} + +// NewApiDiagnosticID returns a new ApiDiagnosticId struct +func NewApiDiagnosticID(subscriptionId string, resourceGroupName string, serviceName string, apiId string, diagnosticId string) ApiDiagnosticId { + return ApiDiagnosticId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + DiagnosticId: diagnosticId, + } +} + +// ParseApiDiagnosticID parses 'input' into a ApiDiagnosticId +func ParseApiDiagnosticID(input string) (*ApiDiagnosticId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiDiagnosticId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiDiagnosticId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + } + + return &id, nil +} + +// ParseApiDiagnosticIDInsensitively parses 'input' case-insensitively into a ApiDiagnosticId +// note: this method should only be used for API response data and not user input +func ParseApiDiagnosticIDInsensitively(input string) (*ApiDiagnosticId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiDiagnosticId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiDiagnosticId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + } + + return &id, nil +} + +// ValidateApiDiagnosticID checks that 'input' can be parsed as a Api Diagnostic ID +func ValidateApiDiagnosticID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApiDiagnosticID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api Diagnostic ID +func (id ApiDiagnosticId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s/diagnostics/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId, id.DiagnosticId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api Diagnostic ID +func (id ApiDiagnosticId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + resourceids.StaticSegment("staticDiagnostics", "diagnostics", "diagnostics"), + resourceids.UserSpecifiedSegment("diagnosticId", "diagnosticIdValue"), + } +} + +// String returns a human-readable description of this Api Diagnostic ID +func (id ApiDiagnosticId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + fmt.Sprintf("Diagnostic: %q", id.DiagnosticId), + } + return fmt.Sprintf("Api Diagnostic (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_createorupdate.go new file mode 100644 index 000000000000..d50634ca8da9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_createorupdate.go @@ -0,0 +1,85 @@ +package apidiagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiDiagnosticClient) CreateOrUpdate(ctx context.Context, id ApiDiagnosticId, input DiagnosticContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_delete.go new file mode 100644 index 000000000000..0fb3223f00ff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_delete.go @@ -0,0 +1,76 @@ +package apidiagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiDiagnosticClient) Delete(ctx context.Context, id ApiDiagnosticId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_get.go new file mode 100644 index 000000000000..26dffc0cd3e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_get.go @@ -0,0 +1,51 @@ +package apidiagnostic + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +// Get ... +func (c ApiDiagnosticClient) Get(ctx context.Context, id ApiDiagnosticId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_getentitytag.go new file mode 100644 index 000000000000..312e0f374143 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_getentitytag.go @@ -0,0 +1,46 @@ +package apidiagnostic + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiDiagnosticClient) GetEntityTag(ctx context.Context, id ApiDiagnosticId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_listbyservice.go new file mode 100644 index 000000000000..125ebd65d5f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_listbyservice.go @@ -0,0 +1,125 @@ +package apidiagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DiagnosticContract +} + +type ListByServiceCompleteResult struct { + Items []DiagnosticContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiDiagnosticClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/diagnostics", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DiagnosticContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiDiagnosticClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, DiagnosticContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiDiagnosticClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate DiagnosticContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]DiagnosticContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_update.go new file mode 100644 index 000000000000..b5341b3da3e8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_update.go @@ -0,0 +1,84 @@ +package apidiagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiDiagnosticClient) Update(ctx context.Context, id ApiDiagnosticId, input DiagnosticContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_bodydiagnosticsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_bodydiagnosticsettings.go new file mode 100644 index 000000000000..dad67d6d8b43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_bodydiagnosticsettings.go @@ -0,0 +1,8 @@ +package apidiagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BodyDiagnosticSettings struct { + Bytes *int64 `json:"bytes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_datamasking.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_datamasking.go new file mode 100644 index 000000000000..e4224370d26a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_datamasking.go @@ -0,0 +1,9 @@ +package apidiagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataMasking struct { + Headers *[]DataMaskingEntity `json:"headers,omitempty"` + QueryParams *[]DataMaskingEntity `json:"queryParams,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_datamaskingentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_datamaskingentity.go new file mode 100644 index 000000000000..232eb3022cef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_datamaskingentity.go @@ -0,0 +1,9 @@ +package apidiagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataMaskingEntity struct { + Mode *DataMaskingMode `json:"mode,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_diagnosticcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_diagnosticcontract.go new file mode 100644 index 000000000000..c11ca5d935f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_diagnosticcontract.go @@ -0,0 +1,11 @@ +package apidiagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DiagnosticContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_diagnosticcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_diagnosticcontractproperties.go new file mode 100644 index 000000000000..72088ff5c559 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_diagnosticcontractproperties.go @@ -0,0 +1,17 @@ +package apidiagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticContractProperties struct { + AlwaysLog *AlwaysLog `json:"alwaysLog,omitempty"` + Backend *PipelineDiagnosticSettings `json:"backend,omitempty"` + Frontend *PipelineDiagnosticSettings `json:"frontend,omitempty"` + HTTPCorrelationProtocol *HTTPCorrelationProtocol `json:"httpCorrelationProtocol,omitempty"` + LogClientIP *bool `json:"logClientIp,omitempty"` + LoggerId string `json:"loggerId"` + Metrics *bool `json:"metrics,omitempty"` + OperationNameFormat *OperationNameFormat `json:"operationNameFormat,omitempty"` + Sampling *SamplingSettings `json:"sampling,omitempty"` + Verbosity *Verbosity `json:"verbosity,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_httpmessagediagnostic.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_httpmessagediagnostic.go new file mode 100644 index 000000000000..03079feace57 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_httpmessagediagnostic.go @@ -0,0 +1,10 @@ +package apidiagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HTTPMessageDiagnostic struct { + Body *BodyDiagnosticSettings `json:"body,omitempty"` + DataMasking *DataMasking `json:"dataMasking,omitempty"` + Headers *[]string `json:"headers,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_pipelinediagnosticsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_pipelinediagnosticsettings.go new file mode 100644 index 000000000000..902e9ce6a62f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_pipelinediagnosticsettings.go @@ -0,0 +1,9 @@ +package apidiagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PipelineDiagnosticSettings struct { + Request *HTTPMessageDiagnostic `json:"request,omitempty"` + Response *HTTPMessageDiagnostic `json:"response,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_samplingsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_samplingsettings.go new file mode 100644 index 000000000000..c6e6b44983d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/model_samplingsettings.go @@ -0,0 +1,9 @@ +package apidiagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SamplingSettings struct { + Percentage *float64 `json:"percentage,omitempty"` + SamplingType *SamplingType `json:"samplingType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/predicates.go new file mode 100644 index 000000000000..0ab615cd8e8c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/predicates.go @@ -0,0 +1,27 @@ +package apidiagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DiagnosticContractOperationPredicate) Matches(input DiagnosticContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/version.go new file mode 100644 index 000000000000..25601af39292 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic/version.go @@ -0,0 +1,12 @@ +package apidiagnostic + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/apidiagnostic/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/README.md new file mode 100644 index 000000000000..5b8c20a4abdb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/README.md @@ -0,0 +1,220 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice` Documentation + +The `apimanagementservice` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice" +``` + + +### Client Initialization + +```go +client := apimanagementservice.NewApiManagementServiceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApiManagementServiceClient.ApplyNetworkConfigurationUpdates` + +```go +ctx := context.TODO() +id := apimanagementservice.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +payload := apimanagementservice.ApiManagementServiceApplyNetworkConfigurationParameters{ + // ... +} + + +if err := client.ApplyNetworkConfigurationUpdatesThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ApiManagementServiceClient.Backup` + +```go +ctx := context.TODO() +id := apimanagementservice.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +payload := apimanagementservice.ApiManagementServiceBackupRestoreParameters{ + // ... +} + + +if err := client.BackupThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ApiManagementServiceClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := apimanagementservice.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := apimanagementservice.ApiManagementServiceCheckNameAvailabilityParameters{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiManagementServiceClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := apimanagementservice.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +payload := apimanagementservice.ApiManagementServiceResource{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ApiManagementServiceClient.Delete` + +```go +ctx := context.TODO() +id := apimanagementservice.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ApiManagementServiceClient.Get` + +```go +ctx := context.TODO() +id := apimanagementservice.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiManagementServiceClient.GetDomainOwnershipIdentifier` + +```go +ctx := context.TODO() +id := apimanagementservice.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.GetDomainOwnershipIdentifier(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiManagementServiceClient.GetSsoToken` + +```go +ctx := context.TODO() +id := apimanagementservice.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +read, err := client.GetSsoToken(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiManagementServiceClient.List` + +```go +ctx := context.TODO() +id := apimanagementservice.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ApiManagementServiceClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := apimanagementservice.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ApiManagementServiceClient.Restore` + +```go +ctx := context.TODO() +id := apimanagementservice.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +payload := apimanagementservice.ApiManagementServiceBackupRestoreParameters{ + // ... +} + + +if err := client.RestoreThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ApiManagementServiceClient.Update` + +```go +ctx := context.TODO() +id := apimanagementservice.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +payload := apimanagementservice.ApiManagementServiceUpdateParameters{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/client.go new file mode 100644 index 000000000000..7c5932f73167 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/client.go @@ -0,0 +1,26 @@ +package apimanagementservice + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiManagementServiceClient struct { + Client *resourcemanager.Client +} + +func NewApiManagementServiceClientWithBaseURI(sdkApi sdkEnv.Api) (*ApiManagementServiceClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "apimanagementservice", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiManagementServiceClient: %+v", err) + } + + return &ApiManagementServiceClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/constants.go new file mode 100644 index 000000000000..2828a0eda162 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/constants.go @@ -0,0 +1,509 @@ +package apimanagementservice + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessType string + +const ( + AccessTypeAccessKey AccessType = "AccessKey" + AccessTypeSystemAssignedManagedIdentity AccessType = "SystemAssignedManagedIdentity" + AccessTypeUserAssignedManagedIdentity AccessType = "UserAssignedManagedIdentity" +) + +func PossibleValuesForAccessType() []string { + return []string{ + string(AccessTypeAccessKey), + string(AccessTypeSystemAssignedManagedIdentity), + string(AccessTypeUserAssignedManagedIdentity), + } +} + +func (s *AccessType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAccessType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAccessType(input string) (*AccessType, error) { + vals := map[string]AccessType{ + "accesskey": AccessTypeAccessKey, + "systemassignedmanagedidentity": AccessTypeSystemAssignedManagedIdentity, + "userassignedmanagedidentity": AccessTypeUserAssignedManagedIdentity, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessType(input) + return &out, nil +} + +type CertificateSource string + +const ( + CertificateSourceBuiltIn CertificateSource = "BuiltIn" + CertificateSourceCustom CertificateSource = "Custom" + CertificateSourceKeyVault CertificateSource = "KeyVault" + CertificateSourceManaged CertificateSource = "Managed" +) + +func PossibleValuesForCertificateSource() []string { + return []string{ + string(CertificateSourceBuiltIn), + string(CertificateSourceCustom), + string(CertificateSourceKeyVault), + string(CertificateSourceManaged), + } +} + +func (s *CertificateSource) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCertificateSource(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCertificateSource(input string) (*CertificateSource, error) { + vals := map[string]CertificateSource{ + "builtin": CertificateSourceBuiltIn, + "custom": CertificateSourceCustom, + "keyvault": CertificateSourceKeyVault, + "managed": CertificateSourceManaged, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CertificateSource(input) + return &out, nil +} + +type CertificateStatus string + +const ( + CertificateStatusCompleted CertificateStatus = "Completed" + CertificateStatusFailed CertificateStatus = "Failed" + CertificateStatusInProgress CertificateStatus = "InProgress" +) + +func PossibleValuesForCertificateStatus() []string { + return []string{ + string(CertificateStatusCompleted), + string(CertificateStatusFailed), + string(CertificateStatusInProgress), + } +} + +func (s *CertificateStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCertificateStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCertificateStatus(input string) (*CertificateStatus, error) { + vals := map[string]CertificateStatus{ + "completed": CertificateStatusCompleted, + "failed": CertificateStatusFailed, + "inprogress": CertificateStatusInProgress, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CertificateStatus(input) + return &out, nil +} + +type HostnameType string + +const ( + HostnameTypeDeveloperPortal HostnameType = "DeveloperPortal" + HostnameTypeManagement HostnameType = "Management" + HostnameTypePortal HostnameType = "Portal" + HostnameTypeProxy HostnameType = "Proxy" + HostnameTypeScm HostnameType = "Scm" +) + +func PossibleValuesForHostnameType() []string { + return []string{ + string(HostnameTypeDeveloperPortal), + string(HostnameTypeManagement), + string(HostnameTypePortal), + string(HostnameTypeProxy), + string(HostnameTypeScm), + } +} + +func (s *HostnameType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHostnameType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHostnameType(input string) (*HostnameType, error) { + vals := map[string]HostnameType{ + "developerportal": HostnameTypeDeveloperPortal, + "management": HostnameTypeManagement, + "portal": HostnameTypePortal, + "proxy": HostnameTypeProxy, + "scm": HostnameTypeScm, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HostnameType(input) + return &out, nil +} + +type NameAvailabilityReason string + +const ( + NameAvailabilityReasonAlreadyExists NameAvailabilityReason = "AlreadyExists" + NameAvailabilityReasonInvalid NameAvailabilityReason = "Invalid" + NameAvailabilityReasonValid NameAvailabilityReason = "Valid" +) + +func PossibleValuesForNameAvailabilityReason() []string { + return []string{ + string(NameAvailabilityReasonAlreadyExists), + string(NameAvailabilityReasonInvalid), + string(NameAvailabilityReasonValid), + } +} + +func (s *NameAvailabilityReason) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNameAvailabilityReason(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNameAvailabilityReason(input string) (*NameAvailabilityReason, error) { + vals := map[string]NameAvailabilityReason{ + "alreadyexists": NameAvailabilityReasonAlreadyExists, + "invalid": NameAvailabilityReasonInvalid, + "valid": NameAvailabilityReasonValid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NameAvailabilityReason(input) + return &out, nil +} + +type PlatformVersion string + +const ( + PlatformVersionMtvOne PlatformVersion = "mtv1" + PlatformVersionStvOne PlatformVersion = "stv1" + PlatformVersionStvTwo PlatformVersion = "stv2" + PlatformVersionUndetermined PlatformVersion = "undetermined" +) + +func PossibleValuesForPlatformVersion() []string { + return []string{ + string(PlatformVersionMtvOne), + string(PlatformVersionStvOne), + string(PlatformVersionStvTwo), + string(PlatformVersionUndetermined), + } +} + +func (s *PlatformVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePlatformVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePlatformVersion(input string) (*PlatformVersion, error) { + vals := map[string]PlatformVersion{ + "mtv1": PlatformVersionMtvOne, + "stv1": PlatformVersionStvOne, + "stv2": PlatformVersionStvTwo, + "undetermined": PlatformVersionUndetermined, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PlatformVersion(input) + return &out, nil +} + +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { + return []string{ + string(PrivateEndpointServiceConnectionStatusApproved), + string(PrivateEndpointServiceConnectionStatusPending), + string(PrivateEndpointServiceConnectionStatusRejected), + } +} + +func (s *PrivateEndpointServiceConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointServiceConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { + vals := map[string]PrivateEndpointServiceConnectionStatus{ + "approved": PrivateEndpointServiceConnectionStatusApproved, + "pending": PrivateEndpointServiceConnectionStatusPending, + "rejected": PrivateEndpointServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointServiceConnectionStatus(input) + return &out, nil +} + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func (s *PublicNetworkAccess) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicNetworkAccess(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} + +type SkuType string + +const ( + SkuTypeBasic SkuType = "Basic" + SkuTypeConsumption SkuType = "Consumption" + SkuTypeDeveloper SkuType = "Developer" + SkuTypeIsolated SkuType = "Isolated" + SkuTypePremium SkuType = "Premium" + SkuTypeStandard SkuType = "Standard" +) + +func PossibleValuesForSkuType() []string { + return []string{ + string(SkuTypeBasic), + string(SkuTypeConsumption), + string(SkuTypeDeveloper), + string(SkuTypeIsolated), + string(SkuTypePremium), + string(SkuTypeStandard), + } +} + +func (s *SkuType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkuType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSkuType(input string) (*SkuType, error) { + vals := map[string]SkuType{ + "basic": SkuTypeBasic, + "consumption": SkuTypeConsumption, + "developer": SkuTypeDeveloper, + "isolated": SkuTypeIsolated, + "premium": SkuTypePremium, + "standard": SkuTypeStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuType(input) + return &out, nil +} + +type StoreName string + +const ( + StoreNameCertificateAuthority StoreName = "CertificateAuthority" + StoreNameRoot StoreName = "Root" +) + +func PossibleValuesForStoreName() []string { + return []string{ + string(StoreNameCertificateAuthority), + string(StoreNameRoot), + } +} + +func (s *StoreName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStoreName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStoreName(input string) (*StoreName, error) { + vals := map[string]StoreName{ + "certificateauthority": StoreNameCertificateAuthority, + "root": StoreNameRoot, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StoreName(input) + return &out, nil +} + +type VirtualNetworkType string + +const ( + VirtualNetworkTypeExternal VirtualNetworkType = "External" + VirtualNetworkTypeInternal VirtualNetworkType = "Internal" + VirtualNetworkTypeNone VirtualNetworkType = "None" +) + +func PossibleValuesForVirtualNetworkType() []string { + return []string{ + string(VirtualNetworkTypeExternal), + string(VirtualNetworkTypeInternal), + string(VirtualNetworkTypeNone), + } +} + +func (s *VirtualNetworkType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualNetworkType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualNetworkType(input string) (*VirtualNetworkType, error) { + vals := map[string]VirtualNetworkType{ + "external": VirtualNetworkTypeExternal, + "internal": VirtualNetworkTypeInternal, + "none": VirtualNetworkTypeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualNetworkType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/id_service.go new file mode 100644 index 000000000000..95a62caed84e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/id_service.go @@ -0,0 +1,127 @@ +package apimanagementservice + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_applynetworkconfigurationupdates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_applynetworkconfigurationupdates.go new file mode 100644 index 000000000000..47666690d419 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_applynetworkconfigurationupdates.go @@ -0,0 +1,74 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplyNetworkConfigurationUpdatesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ApplyNetworkConfigurationUpdates ... +func (c ApiManagementServiceClient) ApplyNetworkConfigurationUpdates(ctx context.Context, id ServiceId, input ApiManagementServiceApplyNetworkConfigurationParameters) (result ApplyNetworkConfigurationUpdatesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/applynetworkconfigurationupdates", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ApplyNetworkConfigurationUpdatesThenPoll performs ApplyNetworkConfigurationUpdates then polls until it's completed +func (c ApiManagementServiceClient) ApplyNetworkConfigurationUpdatesThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceApplyNetworkConfigurationParameters) error { + result, err := c.ApplyNetworkConfigurationUpdates(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ApplyNetworkConfigurationUpdates: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApplyNetworkConfigurationUpdates: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_backup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_backup.go new file mode 100644 index 000000000000..2d68d0ef05f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_backup.go @@ -0,0 +1,74 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Backup ... +func (c ApiManagementServiceClient) Backup(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) (result BackupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/backup", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// BackupThenPoll performs Backup then polls until it's completed +func (c ApiManagementServiceClient) BackupThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) error { + result, err := c.Backup(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Backup: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Backup: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_checknameavailability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_checknameavailability.go new file mode 100644 index 000000000000..69c30c855602 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_checknameavailability.go @@ -0,0 +1,57 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiManagementServiceNameAvailabilityResult +} + +// CheckNameAvailability ... +func (c ApiManagementServiceClient) CheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input ApiManagementServiceCheckNameAvailabilityParameters) (result CheckNameAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/checkNameAvailability", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_createorupdate.go new file mode 100644 index 000000000000..37d9326ce196 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_createorupdate.go @@ -0,0 +1,75 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c ApiManagementServiceClient) CreateOrUpdate(ctx context.Context, id ServiceId, input ApiManagementServiceResource) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ApiManagementServiceClient) CreateOrUpdateThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceResource) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_delete.go new file mode 100644 index 000000000000..e40cd93940a7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_delete.go @@ -0,0 +1,71 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ApiManagementServiceClient) Delete(ctx context.Context, id ServiceId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ApiManagementServiceClient) DeleteThenPoll(ctx context.Context, id ServiceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_get.go new file mode 100644 index 000000000000..a12ef17aed4b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_get.go @@ -0,0 +1,51 @@ +package apimanagementservice + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiManagementServiceResource +} + +// Get ... +func (c ApiManagementServiceClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getdomainownershipidentifier.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getdomainownershipidentifier.go new file mode 100644 index 000000000000..de103cd5209a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getdomainownershipidentifier.go @@ -0,0 +1,53 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDomainOwnershipIdentifierOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiManagementServiceGetDomainOwnershipIdentifierResult +} + +// GetDomainOwnershipIdentifier ... +func (c ApiManagementServiceClient) GetDomainOwnershipIdentifier(ctx context.Context, id commonids.SubscriptionId) (result GetDomainOwnershipIdentifierOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getssotoken.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getssotoken.go new file mode 100644 index 000000000000..2831bca105b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getssotoken.go @@ -0,0 +1,52 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetSsoTokenOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiManagementServiceGetSsoTokenResult +} + +// GetSsoToken ... +func (c ApiManagementServiceClient) GetSsoToken(ctx context.Context, id ServiceId) (result GetSsoTokenOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/getssotoken", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_list.go new file mode 100644 index 000000000000..2f75508ba8a1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_list.go @@ -0,0 +1,90 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiManagementServiceResource +} + +type ListCompleteResult struct { + Items []ApiManagementServiceResource +} + +// List ... +func (c ApiManagementServiceClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/service", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiManagementServiceResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c ApiManagementServiceClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ApiManagementServiceResourceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiManagementServiceClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ApiManagementServiceResourceOperationPredicate) (result ListCompleteResult, err error) { + items := make([]ApiManagementServiceResource, 0) + + resp, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_listbyresourcegroup.go new file mode 100644 index 000000000000..46aadae6bda6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_listbyresourcegroup.go @@ -0,0 +1,90 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiManagementServiceResource +} + +type ListByResourceGroupCompleteResult struct { + Items []ApiManagementServiceResource +} + +// ListByResourceGroup ... +func (c ApiManagementServiceClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/service", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiManagementServiceResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c ApiManagementServiceClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ApiManagementServiceResourceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiManagementServiceClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ApiManagementServiceResourceOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ApiManagementServiceResource, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_restore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_restore.go new file mode 100644 index 000000000000..5ea017b59056 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_restore.go @@ -0,0 +1,74 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestoreOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Restore ... +func (c ApiManagementServiceClient) Restore(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) (result RestoreOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restore", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// RestoreThenPoll performs Restore then polls until it's completed +func (c ApiManagementServiceClient) RestoreThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) error { + result, err := c.Restore(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Restore: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Restore: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_update.go new file mode 100644 index 000000000000..9a2e8907c9b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_update.go @@ -0,0 +1,74 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Update ... +func (c ApiManagementServiceClient) Update(ctx context.Context, id ServiceId, input ApiManagementServiceUpdateParameters) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ApiManagementServiceClient) UpdateThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceUpdateParameters) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_additionallocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_additionallocation.go new file mode 100644 index 000000000000..d2de2898b7d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_additionallocation.go @@ -0,0 +1,21 @@ +package apimanagementservice + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalLocation struct { + DisableGateway *bool `json:"disableGateway,omitempty"` + GatewayRegionalUrl *string `json:"gatewayRegionalUrl,omitempty"` + Location string `json:"location"` + PlatformVersion *PlatformVersion `json:"platformVersion,omitempty"` + PrivateIPAddresses *[]string `json:"privateIPAddresses,omitempty"` + PublicIPAddressId *string `json:"publicIpAddressId,omitempty"` + PublicIPAddresses *[]string `json:"publicIPAddresses,omitempty"` + Sku ApiManagementServiceSkuProperties `json:"sku"` + VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceapplynetworkconfigurationparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceapplynetworkconfigurationparameters.go new file mode 100644 index 000000000000..350416344ec4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceapplynetworkconfigurationparameters.go @@ -0,0 +1,8 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiManagementServiceApplyNetworkConfigurationParameters struct { + Location *string `json:"location,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicebackuprestoreparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicebackuprestoreparameters.go new file mode 100644 index 000000000000..7c0210d9419b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicebackuprestoreparameters.go @@ -0,0 +1,13 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiManagementServiceBackupRestoreParameters struct { + AccessKey *string `json:"accessKey,omitempty"` + AccessType *AccessType `json:"accessType,omitempty"` + BackupName string `json:"backupName"` + ClientId *string `json:"clientId,omitempty"` + ContainerName string `json:"containerName"` + StorageAccount string `json:"storageAccount"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicechecknameavailabilityparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicechecknameavailabilityparameters.go new file mode 100644 index 000000000000..f83b6ff078c4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicechecknameavailabilityparameters.go @@ -0,0 +1,8 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiManagementServiceCheckNameAvailabilityParameters struct { + Name string `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicegetdomainownershipidentifierresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicegetdomainownershipidentifierresult.go new file mode 100644 index 000000000000..1bff72cb7397 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicegetdomainownershipidentifierresult.go @@ -0,0 +1,8 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiManagementServiceGetDomainOwnershipIdentifierResult struct { + DomainOwnershipIdentifier *string `json:"domainOwnershipIdentifier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicegetssotokenresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicegetssotokenresult.go new file mode 100644 index 000000000000..7130e79b7a1c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicegetssotokenresult.go @@ -0,0 +1,8 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiManagementServiceGetSsoTokenResult struct { + RedirectUri *string `json:"redirectUri,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicenameavailabilityresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicenameavailabilityresult.go new file mode 100644 index 000000000000..ae214e4d0fc3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementservicenameavailabilityresult.go @@ -0,0 +1,10 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiManagementServiceNameAvailabilityResult struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *NameAvailabilityReason `json:"reason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceproperties.go new file mode 100644 index 000000000000..0dfbbc2cf9a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceproperties.go @@ -0,0 +1,53 @@ +package apimanagementservice + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiManagementServiceProperties struct { + AdditionalLocations *[]AdditionalLocation `json:"additionalLocations,omitempty"` + ApiVersionConstraint *ApiVersionConstraint `json:"apiVersionConstraint,omitempty"` + Certificates *[]CertificateConfiguration `json:"certificates,omitempty"` + CreatedAtUtc *string `json:"createdAtUtc,omitempty"` + CustomProperties *map[string]string `json:"customProperties,omitempty"` + DeveloperPortalUrl *string `json:"developerPortalUrl,omitempty"` + DisableGateway *bool `json:"disableGateway,omitempty"` + EnableClientCertificate *bool `json:"enableClientCertificate,omitempty"` + GatewayRegionalUrl *string `json:"gatewayRegionalUrl,omitempty"` + GatewayUrl *string `json:"gatewayUrl,omitempty"` + HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` + ManagementApiUrl *string `json:"managementApiUrl,omitempty"` + NotificationSenderEmail *string `json:"notificationSenderEmail,omitempty"` + PlatformVersion *PlatformVersion `json:"platformVersion,omitempty"` + PortalUrl *string `json:"portalUrl,omitempty"` + PrivateEndpointConnections *[]RemotePrivateEndpointConnectionWrapper `json:"privateEndpointConnections,omitempty"` + PrivateIPAddresses *[]string `json:"privateIPAddresses,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + PublicIPAddressId *string `json:"publicIpAddressId,omitempty"` + PublicIPAddresses *[]string `json:"publicIPAddresses,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + PublisherEmail string `json:"publisherEmail"` + PublisherName string `json:"publisherName"` + Restore *bool `json:"restore,omitempty"` + ScmUrl *string `json:"scmUrl,omitempty"` + TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` + VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` + VirtualNetworkType *VirtualNetworkType `json:"virtualNetworkType,omitempty"` +} + +func (o *ApiManagementServiceProperties) GetCreatedAtUtcAsTime() (*time.Time, error) { + if o.CreatedAtUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAtUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *ApiManagementServiceProperties) SetCreatedAtUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAtUtc = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceresource.go new file mode 100644 index 000000000000..3902958da88e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceresource.go @@ -0,0 +1,24 @@ +package apimanagementservice + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiManagementServiceResource struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties ApiManagementServiceProperties `json:"properties"` + Sku ApiManagementServiceSkuProperties `json:"sku"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceskuproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceskuproperties.go new file mode 100644 index 000000000000..6839fec52ed2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceskuproperties.go @@ -0,0 +1,9 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiManagementServiceSkuProperties struct { + Capacity int64 `json:"capacity"` + Name SkuType `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceupdateparameters.go new file mode 100644 index 000000000000..11a3252fef71 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceupdateparameters.go @@ -0,0 +1,21 @@ +package apimanagementservice + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiManagementServiceUpdateParameters struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ApiManagementServiceUpdateProperties `json:"properties,omitempty"` + Sku *ApiManagementServiceSkuProperties `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceupdateproperties.go new file mode 100644 index 000000000000..f83820e9d9f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apimanagementserviceupdateproperties.go @@ -0,0 +1,53 @@ +package apimanagementservice + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiManagementServiceUpdateProperties struct { + AdditionalLocations *[]AdditionalLocation `json:"additionalLocations,omitempty"` + ApiVersionConstraint *ApiVersionConstraint `json:"apiVersionConstraint,omitempty"` + Certificates *[]CertificateConfiguration `json:"certificates,omitempty"` + CreatedAtUtc *string `json:"createdAtUtc,omitempty"` + CustomProperties *map[string]string `json:"customProperties,omitempty"` + DeveloperPortalUrl *string `json:"developerPortalUrl,omitempty"` + DisableGateway *bool `json:"disableGateway,omitempty"` + EnableClientCertificate *bool `json:"enableClientCertificate,omitempty"` + GatewayRegionalUrl *string `json:"gatewayRegionalUrl,omitempty"` + GatewayUrl *string `json:"gatewayUrl,omitempty"` + HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` + ManagementApiUrl *string `json:"managementApiUrl,omitempty"` + NotificationSenderEmail *string `json:"notificationSenderEmail,omitempty"` + PlatformVersion *PlatformVersion `json:"platformVersion,omitempty"` + PortalUrl *string `json:"portalUrl,omitempty"` + PrivateEndpointConnections *[]RemotePrivateEndpointConnectionWrapper `json:"privateEndpointConnections,omitempty"` + PrivateIPAddresses *[]string `json:"privateIPAddresses,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + PublicIPAddressId *string `json:"publicIpAddressId,omitempty"` + PublicIPAddresses *[]string `json:"publicIPAddresses,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + PublisherEmail *string `json:"publisherEmail,omitempty"` + PublisherName *string `json:"publisherName,omitempty"` + Restore *bool `json:"restore,omitempty"` + ScmUrl *string `json:"scmUrl,omitempty"` + TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` + VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` + VirtualNetworkType *VirtualNetworkType `json:"virtualNetworkType,omitempty"` +} + +func (o *ApiManagementServiceUpdateProperties) GetCreatedAtUtcAsTime() (*time.Time, error) { + if o.CreatedAtUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAtUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *ApiManagementServiceUpdateProperties) SetCreatedAtUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAtUtc = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apiversionconstraint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apiversionconstraint.go new file mode 100644 index 000000000000..449dc717bf09 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_apiversionconstraint.go @@ -0,0 +1,8 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiVersionConstraint struct { + MinApiVersion *string `json:"minApiVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_armidwrapper.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_armidwrapper.go new file mode 100644 index 000000000000..224755cee003 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_armidwrapper.go @@ -0,0 +1,8 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArmIdWrapper struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_certificateconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_certificateconfiguration.go new file mode 100644 index 000000000000..ce78a7c6e51d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_certificateconfiguration.go @@ -0,0 +1,11 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateConfiguration struct { + Certificate *CertificateInformation `json:"certificate,omitempty"` + CertificatePassword *string `json:"certificatePassword,omitempty"` + EncodedCertificate *string `json:"encodedCertificate,omitempty"` + StoreName StoreName `json:"storeName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_certificateinformation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_certificateinformation.go new file mode 100644 index 000000000000..f9b034329878 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_certificateinformation.go @@ -0,0 +1,25 @@ +package apimanagementservice + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateInformation struct { + Expiry string `json:"expiry"` + Subject string `json:"subject"` + Thumbprint string `json:"thumbprint"` +} + +func (o *CertificateInformation) GetExpiryAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.Expiry, "2006-01-02T15:04:05Z07:00") +} + +func (o *CertificateInformation) SetExpiryAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Expiry = formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_hostnameconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_hostnameconfiguration.go new file mode 100644 index 000000000000..304fc3343639 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_hostnameconfiguration.go @@ -0,0 +1,18 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostnameConfiguration struct { + Certificate *CertificateInformation `json:"certificate,omitempty"` + CertificatePassword *string `json:"certificatePassword,omitempty"` + CertificateSource *CertificateSource `json:"certificateSource,omitempty"` + CertificateStatus *CertificateStatus `json:"certificateStatus,omitempty"` + DefaultSslBinding *bool `json:"defaultSslBinding,omitempty"` + EncodedCertificate *string `json:"encodedCertificate,omitempty"` + HostName string `json:"hostName"` + IdentityClientId *string `json:"identityClientId,omitempty"` + KeyVaultId *string `json:"keyVaultId,omitempty"` + NegotiateClientCertificate *bool `json:"negotiateClientCertificate,omitempty"` + Type HostnameType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_privateendpointconnectionwrapperproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_privateendpointconnectionwrapperproperties.go new file mode 100644 index 000000000000..a8861b48f9f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_privateendpointconnectionwrapperproperties.go @@ -0,0 +1,11 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionWrapperProperties struct { + GroupIds *[]string `json:"groupIds,omitempty"` + PrivateEndpoint *ArmIdWrapper `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_privatelinkserviceconnectionstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_privatelinkserviceconnectionstate.go new file mode 100644 index 000000000000..eaf5c7d9c802 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_remoteprivateendpointconnectionwrapper.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_remoteprivateendpointconnectionwrapper.go new file mode 100644 index 000000000000..9c2608a5887a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_remoteprivateendpointconnectionwrapper.go @@ -0,0 +1,11 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemotePrivateEndpointConnectionWrapper struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionWrapperProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_virtualnetworkconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_virtualnetworkconfiguration.go new file mode 100644 index 000000000000..77c716aaab64 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/model_virtualnetworkconfiguration.go @@ -0,0 +1,10 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkConfiguration struct { + SubnetResourceId *string `json:"subnetResourceId,omitempty"` + Subnetname *string `json:"subnetname,omitempty"` + Vnetid *string `json:"vnetid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/predicates.go new file mode 100644 index 000000000000..0aedfbdb9dfe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/predicates.go @@ -0,0 +1,37 @@ +package apimanagementservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiManagementServiceResourceOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p ApiManagementServiceResourceOperationPredicate) Matches(input ApiManagementServiceResource) bool { + + if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/version.go new file mode 100644 index 000000000000..40b624769803 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice/version.go @@ -0,0 +1,12 @@ +package apimanagementservice + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/apimanagementservice/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/README.md new file mode 100644 index 000000000000..c75764305533 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation` Documentation + +The `apioperation` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation" +``` + + +### Client Initialization + +```go +client := apioperation.NewApiOperationClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApiOperationClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := apioperation.NewOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "operationIdValue") + +payload := apioperation.OperationContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, apioperation.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiOperationClient.Delete` + +```go +ctx := context.TODO() +id := apioperation.NewOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "operationIdValue") + +read, err := client.Delete(ctx, id, apioperation.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiOperationClient.Get` + +```go +ctx := context.TODO() +id := apioperation.NewOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "operationIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiOperationClient.GetEntityTag` + +```go +ctx := context.TODO() +id := apioperation.NewOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "operationIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiOperationClient.ListByApi` + +```go +ctx := context.TODO() +id := apioperation.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +// alternatively `client.ListByApi(ctx, id, apioperation.DefaultListByApiOperationOptions())` can be used to do batched pagination +items, err := client.ListByApiComplete(ctx, id, apioperation.DefaultListByApiOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ApiOperationClient.Update` + +```go +ctx := context.TODO() +id := apioperation.NewOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "operationIdValue") + +payload := apioperation.OperationUpdateContract{ + // ... +} + + +read, err := client.Update(ctx, id, payload, apioperation.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/client.go new file mode 100644 index 000000000000..5c9fa6d23e68 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/client.go @@ -0,0 +1,26 @@ +package apioperation + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiOperationClient struct { + Client *resourcemanager.Client +} + +func NewApiOperationClientWithBaseURI(sdkApi sdkEnv.Api) (*ApiOperationClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "apioperation", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiOperationClient: %+v", err) + } + + return &ApiOperationClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/id_api.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/id_api.go new file mode 100644 index 000000000000..79a7327f6228 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/id_api.go @@ -0,0 +1,140 @@ +package apioperation + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApiId{} + +// ApiId is a struct representing the Resource ID for a Api +type ApiId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string +} + +// NewApiID returns a new ApiId struct +func NewApiID(subscriptionId string, resourceGroupName string, serviceName string, apiId string) ApiId { + return ApiId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + } +} + +// ParseApiID parses 'input' into a ApiId +func ParseApiID(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ParseApiIDInsensitively parses 'input' case-insensitively into a ApiId +// note: this method should only be used for API response data and not user input +func ParseApiIDInsensitively(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ValidateApiID checks that 'input' can be parsed as a Api ID +func ValidateApiID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApiID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api ID +func (id ApiId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api ID +func (id ApiId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + } +} + +// String returns a human-readable description of this Api ID +func (id ApiId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + } + return fmt.Sprintf("Api (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/id_operation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/id_operation.go new file mode 100644 index 000000000000..de3ff9a53f68 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/id_operation.go @@ -0,0 +1,153 @@ +package apioperation + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = OperationId{} + +// OperationId is a struct representing the Resource ID for a Operation +type OperationId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string + OperationId string +} + +// NewOperationID returns a new OperationId struct +func NewOperationID(subscriptionId string, resourceGroupName string, serviceName string, apiId string, operationId string) OperationId { + return OperationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + OperationId: operationId, + } +} + +// ParseOperationID parses 'input' into a OperationId +func ParseOperationID(input string) (*OperationId, error) { + parser := resourceids.NewParserFromResourceIdType(OperationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OperationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + } + + return &id, nil +} + +// ParseOperationIDInsensitively parses 'input' case-insensitively into a OperationId +// note: this method should only be used for API response data and not user input +func ParseOperationIDInsensitively(input string) (*OperationId, error) { + parser := resourceids.NewParserFromResourceIdType(OperationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OperationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + } + + return &id, nil +} + +// ValidateOperationID checks that 'input' can be parsed as a Operation ID +func ValidateOperationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseOperationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Operation ID +func (id OperationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s/operations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId, id.OperationId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Operation ID +func (id OperationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + resourceids.StaticSegment("staticOperations", "operations", "operations"), + resourceids.UserSpecifiedSegment("operationId", "operationIdValue"), + } +} + +// String returns a human-readable description of this Operation ID +func (id OperationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + fmt.Sprintf("Operation: %q", id.OperationId), + } + return fmt.Sprintf("Operation (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_createorupdate.go new file mode 100644 index 000000000000..6dc046e355ff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_createorupdate.go @@ -0,0 +1,85 @@ +package apioperation + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OperationContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiOperationClient) CreateOrUpdate(ctx context.Context, id OperationId, input OperationContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_delete.go new file mode 100644 index 000000000000..0693a0a284ff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_delete.go @@ -0,0 +1,76 @@ +package apioperation + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiOperationClient) Delete(ctx context.Context, id OperationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_get.go new file mode 100644 index 000000000000..d5786d5ae915 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_get.go @@ -0,0 +1,51 @@ +package apioperation + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OperationContract +} + +// Get ... +func (c ApiOperationClient) Get(ctx context.Context, id OperationId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_getentitytag.go new file mode 100644 index 000000000000..520a7b92e364 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_getentitytag.go @@ -0,0 +1,46 @@ +package apioperation + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiOperationClient) GetEntityTag(ctx context.Context, id OperationId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_listbyapi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_listbyapi.go new file mode 100644 index 000000000000..5620f8b7c3e2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_listbyapi.go @@ -0,0 +1,129 @@ +package apioperation + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]OperationContract +} + +type ListByApiCompleteResult struct { + Items []OperationContract +} + +type ListByApiOperationOptions struct { + Filter *string + Skip *int64 + Tags *string + Top *int64 +} + +func DefaultListByApiOperationOptions() ListByApiOperationOptions { + return ListByApiOperationOptions{} +} + +func (o ListByApiOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByApiOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByApiOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Tags != nil { + out.Append("tags", fmt.Sprintf("%v", *o.Tags)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByApi ... +func (c ApiOperationClient) ListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (result ListByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/operations", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]OperationContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByApiComplete retrieves all the results into a single object +func (c ApiOperationClient) ListByApiComplete(ctx context.Context, id ApiId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { + return c.ListByApiCompleteMatchingPredicate(ctx, id, options, OperationContractOperationPredicate{}) +} + +// ListByApiCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiOperationClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApiOperationOptions, predicate OperationContractOperationPredicate) (result ListByApiCompleteResult, err error) { + items := make([]OperationContract, 0) + + resp, err := c.ListByApi(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByApiCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_update.go new file mode 100644 index 000000000000..9b215cf692d0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/method_update.go @@ -0,0 +1,84 @@ +package apioperation + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OperationContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiOperationClient) Update(ctx context.Context, id OperationId, input OperationUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationcontract.go new file mode 100644 index 000000000000..873a3fddabcc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationcontract.go @@ -0,0 +1,11 @@ +package apioperation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OperationContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *OperationContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationcontractproperties.go new file mode 100644 index 000000000000..646f7cc73ae5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationcontractproperties.go @@ -0,0 +1,15 @@ +package apioperation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OperationContractProperties struct { + Description *string `json:"description,omitempty"` + DisplayName string `json:"displayName"` + Method string `json:"method"` + Policies *string `json:"policies,omitempty"` + Request *RequestContract `json:"request,omitempty"` + Responses *[]ResponseContract `json:"responses,omitempty"` + TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` + UrlTemplate string `json:"urlTemplate"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationupdatecontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationupdatecontract.go new file mode 100644 index 000000000000..74d6e9a0d9a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationupdatecontract.go @@ -0,0 +1,8 @@ +package apioperation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OperationUpdateContract struct { + Properties *OperationUpdateContractProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationupdatecontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationupdatecontractproperties.go new file mode 100644 index 000000000000..a0d2d1d44209 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_operationupdatecontractproperties.go @@ -0,0 +1,15 @@ +package apioperation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OperationUpdateContractProperties struct { + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Method *string `json:"method,omitempty"` + Policies *string `json:"policies,omitempty"` + Request *RequestContract `json:"request,omitempty"` + Responses *[]ResponseContract `json:"responses,omitempty"` + TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` + UrlTemplate *string `json:"urlTemplate,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_parametercontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_parametercontract.go new file mode 100644 index 000000000000..93f3674edad2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_parametercontract.go @@ -0,0 +1,16 @@ +package apioperation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ParameterContract struct { + DefaultValue *string `json:"defaultValue,omitempty"` + Description *string `json:"description,omitempty"` + Examples *map[string]ParameterExampleContract `json:"examples,omitempty"` + Name string `json:"name"` + Required *bool `json:"required,omitempty"` + SchemaId *string `json:"schemaId,omitempty"` + Type string `json:"type"` + TypeName *string `json:"typeName,omitempty"` + Values *[]string `json:"values,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_parameterexamplecontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_parameterexamplecontract.go new file mode 100644 index 000000000000..2dd4619cc069 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_parameterexamplecontract.go @@ -0,0 +1,11 @@ +package apioperation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ParameterExampleContract struct { + Description *string `json:"description,omitempty"` + ExternalValue *string `json:"externalValue,omitempty"` + Summary *string `json:"summary,omitempty"` + Value *interface{} `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_representationcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_representationcontract.go new file mode 100644 index 000000000000..b4b667978877 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_representationcontract.go @@ -0,0 +1,12 @@ +package apioperation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RepresentationContract struct { + ContentType string `json:"contentType"` + Examples *map[string]ParameterExampleContract `json:"examples,omitempty"` + FormParameters *[]ParameterContract `json:"formParameters,omitempty"` + SchemaId *string `json:"schemaId,omitempty"` + TypeName *string `json:"typeName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_requestcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_requestcontract.go new file mode 100644 index 000000000000..3fac1e8f62b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_requestcontract.go @@ -0,0 +1,11 @@ +package apioperation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RequestContract struct { + Description *string `json:"description,omitempty"` + Headers *[]ParameterContract `json:"headers,omitempty"` + QueryParameters *[]ParameterContract `json:"queryParameters,omitempty"` + Representations *[]RepresentationContract `json:"representations,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_responsecontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_responsecontract.go new file mode 100644 index 000000000000..34e9fe29b994 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/model_responsecontract.go @@ -0,0 +1,11 @@ +package apioperation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResponseContract struct { + Description *string `json:"description,omitempty"` + Headers *[]ParameterContract `json:"headers,omitempty"` + Representations *[]RepresentationContract `json:"representations,omitempty"` + StatusCode int64 `json:"statusCode"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/predicates.go new file mode 100644 index 000000000000..80cc934a835d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/predicates.go @@ -0,0 +1,27 @@ +package apioperation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OperationContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p OperationContractOperationPredicate) Matches(input OperationContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/version.go new file mode 100644 index 000000000000..604ef65f4aa2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation/version.go @@ -0,0 +1,12 @@ +package apioperation + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/apioperation/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/README.md new file mode 100644 index 000000000000..4cb5eccf9218 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/README.md @@ -0,0 +1,105 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy` Documentation + +The `apioperationpolicy` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy" +``` + + +### Client Initialization + +```go +client := apioperationpolicy.NewApiOperationPolicyClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApiOperationPolicyClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := apioperationpolicy.NewOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "operationIdValue") + +payload := apioperationpolicy.PolicyContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, apioperationpolicy.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiOperationPolicyClient.Delete` + +```go +ctx := context.TODO() +id := apioperationpolicy.NewOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "operationIdValue") + +read, err := client.Delete(ctx, id, apioperationpolicy.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiOperationPolicyClient.Get` + +```go +ctx := context.TODO() +id := apioperationpolicy.NewOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "operationIdValue") + +read, err := client.Get(ctx, id, apioperationpolicy.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiOperationPolicyClient.GetEntityTag` + +```go +ctx := context.TODO() +id := apioperationpolicy.NewOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "operationIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiOperationPolicyClient.ListByOperation` + +```go +ctx := context.TODO() +id := apioperationpolicy.NewOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "operationIdValue") + +read, err := client.ListByOperation(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/client.go new file mode 100644 index 000000000000..4c1ef4771152 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/client.go @@ -0,0 +1,26 @@ +package apioperationpolicy + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiOperationPolicyClient struct { + Client *resourcemanager.Client +} + +func NewApiOperationPolicyClientWithBaseURI(sdkApi sdkEnv.Api) (*ApiOperationPolicyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "apioperationpolicy", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiOperationPolicyClient: %+v", err) + } + + return &ApiOperationPolicyClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/constants.go new file mode 100644 index 000000000000..5a4b902d0cfc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/constants.go @@ -0,0 +1,98 @@ +package apioperationpolicy + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyContentFormat string + +const ( + PolicyContentFormatRawxml PolicyContentFormat = "rawxml" + PolicyContentFormatRawxmlNegativelink PolicyContentFormat = "rawxml-link" + PolicyContentFormatXml PolicyContentFormat = "xml" + PolicyContentFormatXmlNegativelink PolicyContentFormat = "xml-link" +) + +func PossibleValuesForPolicyContentFormat() []string { + return []string{ + string(PolicyContentFormatRawxml), + string(PolicyContentFormatRawxmlNegativelink), + string(PolicyContentFormatXml), + string(PolicyContentFormatXmlNegativelink), + } +} + +func (s *PolicyContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePolicyContentFormat(input string) (*PolicyContentFormat, error) { + vals := map[string]PolicyContentFormat{ + "rawxml": PolicyContentFormatRawxml, + "rawxml-link": PolicyContentFormatRawxmlNegativelink, + "xml": PolicyContentFormatXml, + "xml-link": PolicyContentFormatXmlNegativelink, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyContentFormat(input) + return &out, nil +} + +type PolicyExportFormat string + +const ( + PolicyExportFormatRawxml PolicyExportFormat = "rawxml" + PolicyExportFormatXml PolicyExportFormat = "xml" +) + +func PossibleValuesForPolicyExportFormat() []string { + return []string{ + string(PolicyExportFormatRawxml), + string(PolicyExportFormatXml), + } +} + +func (s *PolicyExportFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyExportFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePolicyExportFormat(input string) (*PolicyExportFormat, error) { + vals := map[string]PolicyExportFormat{ + "rawxml": PolicyExportFormatRawxml, + "xml": PolicyExportFormatXml, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyExportFormat(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/id_operation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/id_operation.go new file mode 100644 index 000000000000..7cb0b5a54c72 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/id_operation.go @@ -0,0 +1,153 @@ +package apioperationpolicy + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = OperationId{} + +// OperationId is a struct representing the Resource ID for a Operation +type OperationId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string + OperationId string +} + +// NewOperationID returns a new OperationId struct +func NewOperationID(subscriptionId string, resourceGroupName string, serviceName string, apiId string, operationId string) OperationId { + return OperationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + OperationId: operationId, + } +} + +// ParseOperationID parses 'input' into a OperationId +func ParseOperationID(input string) (*OperationId, error) { + parser := resourceids.NewParserFromResourceIdType(OperationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OperationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + } + + return &id, nil +} + +// ParseOperationIDInsensitively parses 'input' case-insensitively into a OperationId +// note: this method should only be used for API response data and not user input +func ParseOperationIDInsensitively(input string) (*OperationId, error) { + parser := resourceids.NewParserFromResourceIdType(OperationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OperationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + } + + return &id, nil +} + +// ValidateOperationID checks that 'input' can be parsed as a Operation ID +func ValidateOperationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseOperationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Operation ID +func (id OperationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s/operations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId, id.OperationId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Operation ID +func (id OperationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + resourceids.StaticSegment("staticOperations", "operations", "operations"), + resourceids.UserSpecifiedSegment("operationId", "operationIdValue"), + } +} + +// String returns a human-readable description of this Operation ID +func (id OperationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + fmt.Sprintf("Operation: %q", id.OperationId), + } + return fmt.Sprintf("Operation (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_createorupdate.go new file mode 100644 index 000000000000..a25fdb2042e2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_createorupdate.go @@ -0,0 +1,85 @@ +package apioperationpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiOperationPolicyClient) CreateOrUpdate(ctx context.Context, id OperationId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_delete.go new file mode 100644 index 000000000000..f30d7d3e9326 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_delete.go @@ -0,0 +1,76 @@ +package apioperationpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiOperationPolicyClient) Delete(ctx context.Context, id OperationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_get.go new file mode 100644 index 000000000000..62c2e6262684 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_get.go @@ -0,0 +1,80 @@ +package apioperationpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type GetOperationOptions struct { + Format *PolicyExportFormat +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + return &out +} + +// Get ... +func (c ApiOperationPolicyClient) Get(ctx context.Context, id OperationId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_getentitytag.go new file mode 100644 index 000000000000..88da95a1537b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_getentitytag.go @@ -0,0 +1,47 @@ +package apioperationpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiOperationPolicyClient) GetEntityTag(ctx context.Context, id OperationId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_listbyoperation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_listbyoperation.go new file mode 100644 index 000000000000..0f79c48d5fef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_listbyoperation.go @@ -0,0 +1,52 @@ +package apioperationpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyCollection +} + +// ListByOperation ... +func (c ApiOperationPolicyClient) ListByOperation(ctx context.Context, id OperationId) (result ListByOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/model_policycollection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/model_policycollection.go new file mode 100644 index 000000000000..13cc9f705482 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/model_policycollection.go @@ -0,0 +1,10 @@ +package apioperationpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyCollection struct { + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]PolicyContract `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/model_policycontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/model_policycontract.go new file mode 100644 index 000000000000..4a0e709073fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/model_policycontract.go @@ -0,0 +1,11 @@ +package apioperationpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PolicyContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/model_policycontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/model_policycontractproperties.go new file mode 100644 index 000000000000..ec041034d70e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/model_policycontractproperties.go @@ -0,0 +1,9 @@ +package apioperationpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyContractProperties struct { + Format *PolicyContentFormat `json:"format,omitempty"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/version.go new file mode 100644 index 000000000000..bc34aa23906f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy/version.go @@ -0,0 +1,12 @@ +package apioperationpolicy + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/apioperationpolicy/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/README.md new file mode 100644 index 000000000000..d2ed33b9dd19 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/README.md @@ -0,0 +1,101 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag` Documentation + +The `apioperationtag` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag" +``` + + +### Client Initialization + +```go +client := apioperationtag.NewApiOperationTagClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApiOperationTagClient.TagAssignToOperation` + +```go +ctx := context.TODO() +id := apioperationtag.NewOperationTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "operationIdValue", "tagIdValue") + +read, err := client.TagAssignToOperation(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiOperationTagClient.TagDetachFromOperation` + +```go +ctx := context.TODO() +id := apioperationtag.NewOperationTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "operationIdValue", "tagIdValue") + +read, err := client.TagDetachFromOperation(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiOperationTagClient.TagGetByOperation` + +```go +ctx := context.TODO() +id := apioperationtag.NewOperationTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "operationIdValue", "tagIdValue") + +read, err := client.TagGetByOperation(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiOperationTagClient.TagGetEntityStateByOperation` + +```go +ctx := context.TODO() +id := apioperationtag.NewOperationTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "operationIdValue", "tagIdValue") + +read, err := client.TagGetEntityStateByOperation(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiOperationTagClient.TagListByOperation` + +```go +ctx := context.TODO() +id := apioperationtag.NewOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "operationIdValue") + +// alternatively `client.TagListByOperation(ctx, id, apioperationtag.DefaultTagListByOperationOperationOptions())` can be used to do batched pagination +items, err := client.TagListByOperationComplete(ctx, id, apioperationtag.DefaultTagListByOperationOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/client.go new file mode 100644 index 000000000000..6f14f25474cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/client.go @@ -0,0 +1,26 @@ +package apioperationtag + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiOperationTagClient struct { + Client *resourcemanager.Client +} + +func NewApiOperationTagClientWithBaseURI(sdkApi sdkEnv.Api) (*ApiOperationTagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "apioperationtag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiOperationTagClient: %+v", err) + } + + return &ApiOperationTagClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operation.go new file mode 100644 index 000000000000..80dc723f21e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operation.go @@ -0,0 +1,153 @@ +package apioperationtag + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = OperationId{} + +// OperationId is a struct representing the Resource ID for a Operation +type OperationId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string + OperationId string +} + +// NewOperationID returns a new OperationId struct +func NewOperationID(subscriptionId string, resourceGroupName string, serviceName string, apiId string, operationId string) OperationId { + return OperationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + OperationId: operationId, + } +} + +// ParseOperationID parses 'input' into a OperationId +func ParseOperationID(input string) (*OperationId, error) { + parser := resourceids.NewParserFromResourceIdType(OperationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OperationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + } + + return &id, nil +} + +// ParseOperationIDInsensitively parses 'input' case-insensitively into a OperationId +// note: this method should only be used for API response data and not user input +func ParseOperationIDInsensitively(input string) (*OperationId, error) { + parser := resourceids.NewParserFromResourceIdType(OperationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OperationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + } + + return &id, nil +} + +// ValidateOperationID checks that 'input' can be parsed as a Operation ID +func ValidateOperationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseOperationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Operation ID +func (id OperationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s/operations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId, id.OperationId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Operation ID +func (id OperationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + resourceids.StaticSegment("staticOperations", "operations", "operations"), + resourceids.UserSpecifiedSegment("operationId", "operationIdValue"), + } +} + +// String returns a human-readable description of this Operation ID +func (id OperationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + fmt.Sprintf("Operation: %q", id.OperationId), + } + return fmt.Sprintf("Operation (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operationtag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operationtag.go new file mode 100644 index 000000000000..50b4b0f0385c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operationtag.go @@ -0,0 +1,166 @@ +package apioperationtag + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = OperationTagId{} + +// OperationTagId is a struct representing the Resource ID for a Operation Tag +type OperationTagId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string + OperationId string + TagId string +} + +// NewOperationTagID returns a new OperationTagId struct +func NewOperationTagID(subscriptionId string, resourceGroupName string, serviceName string, apiId string, operationId string, tagId string) OperationTagId { + return OperationTagId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + OperationId: operationId, + TagId: tagId, + } +} + +// ParseOperationTagID parses 'input' into a OperationTagId +func ParseOperationTagID(input string) (*OperationTagId, error) { + parser := resourceids.NewParserFromResourceIdType(OperationTagId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OperationTagId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + } + + if id.TagId, ok = parsed.Parsed["tagId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + } + + return &id, nil +} + +// ParseOperationTagIDInsensitively parses 'input' case-insensitively into a OperationTagId +// note: this method should only be used for API response data and not user input +func ParseOperationTagIDInsensitively(input string) (*OperationTagId, error) { + parser := resourceids.NewParserFromResourceIdType(OperationTagId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OperationTagId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + } + + if id.TagId, ok = parsed.Parsed["tagId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + } + + return &id, nil +} + +// ValidateOperationTagID checks that 'input' can be parsed as a Operation Tag ID +func ValidateOperationTagID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseOperationTagID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Operation Tag ID +func (id OperationTagId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s/operations/%s/tags/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId, id.OperationId, id.TagId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Operation Tag ID +func (id OperationTagId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + resourceids.StaticSegment("staticOperations", "operations", "operations"), + resourceids.UserSpecifiedSegment("operationId", "operationIdValue"), + resourceids.StaticSegment("staticTags", "tags", "tags"), + resourceids.UserSpecifiedSegment("tagId", "tagIdValue"), + } +} + +// String returns a human-readable description of this Operation Tag ID +func (id OperationTagId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + fmt.Sprintf("Operation: %q", id.OperationId), + fmt.Sprintf("Tag: %q", id.TagId), + } + return fmt.Sprintf("Operation Tag (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagassigntooperation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagassigntooperation.go new file mode 100644 index 000000000000..2c431fe03fac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagassigntooperation.go @@ -0,0 +1,52 @@ +package apioperationtag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagAssignToOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagAssignToOperation ... +func (c ApiOperationTagClient) TagAssignToOperation(ctx context.Context, id OperationTagId) (result TagAssignToOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagdetachfromoperation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagdetachfromoperation.go new file mode 100644 index 000000000000..b49f13cabd92 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagdetachfromoperation.go @@ -0,0 +1,47 @@ +package apioperationtag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagDetachFromOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagDetachFromOperation ... +func (c ApiOperationTagClient) TagDetachFromOperation(ctx context.Context, id OperationTagId) (result TagDetachFromOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetbyoperation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetbyoperation.go new file mode 100644 index 000000000000..a56dc05b28f5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetbyoperation.go @@ -0,0 +1,51 @@ +package apioperationtag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetByOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagGetByOperation ... +func (c ApiOperationTagClient) TagGetByOperation(ctx context.Context, id OperationTagId) (result TagGetByOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetentitystatebyoperation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetentitystatebyoperation.go new file mode 100644 index 000000000000..066af82b1906 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetentitystatebyoperation.go @@ -0,0 +1,46 @@ +package apioperationtag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetEntityStateByOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagGetEntityStateByOperation ... +func (c ApiOperationTagClient) TagGetEntityStateByOperation(ctx context.Context, id OperationTagId) (result TagGetEntityStateByOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taglistbyoperation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taglistbyoperation.go new file mode 100644 index 000000000000..b857e4ac1909 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taglistbyoperation.go @@ -0,0 +1,125 @@ +package apioperationtag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagListByOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagContract +} + +type TagListByOperationCompleteResult struct { + Items []TagContract +} + +type TagListByOperationOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultTagListByOperationOperationOptions() TagListByOperationOperationOptions { + return TagListByOperationOperationOptions{} +} + +func (o TagListByOperationOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o TagListByOperationOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o TagListByOperationOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// TagListByOperation ... +func (c ApiOperationTagClient) TagListByOperation(ctx context.Context, id OperationId, options TagListByOperationOperationOptions) (result TagListByOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// TagListByOperationComplete retrieves all the results into a single object +func (c ApiOperationTagClient) TagListByOperationComplete(ctx context.Context, id OperationId, options TagListByOperationOperationOptions) (TagListByOperationCompleteResult, error) { + return c.TagListByOperationCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) +} + +// TagListByOperationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiOperationTagClient) TagListByOperationCompleteMatchingPredicate(ctx context.Context, id OperationId, options TagListByOperationOperationOptions, predicate TagContractOperationPredicate) (result TagListByOperationCompleteResult, err error) { + items := make([]TagContract, 0) + + resp, err := c.TagListByOperation(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = TagListByOperationCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/model_tagcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/model_tagcontract.go new file mode 100644 index 000000000000..def50a679a11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/model_tagcontract.go @@ -0,0 +1,11 @@ +package apioperationtag + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *TagContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/model_tagcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/model_tagcontractproperties.go new file mode 100644 index 000000000000..d4fd365e5f6a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/model_tagcontractproperties.go @@ -0,0 +1,8 @@ +package apioperationtag + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagContractProperties struct { + DisplayName string `json:"displayName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/predicates.go new file mode 100644 index 000000000000..84e8e1e93304 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/predicates.go @@ -0,0 +1,27 @@ +package apioperationtag + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p TagContractOperationPredicate) Matches(input TagContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/version.go new file mode 100644 index 000000000000..cbc495f0a8f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag/version.go @@ -0,0 +1,12 @@ +package apioperationtag + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/apioperationtag/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/README.md new file mode 100644 index 000000000000..4c60aa880871 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/README.md @@ -0,0 +1,105 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy` Documentation + +The `apipolicy` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy" +``` + + +### Client Initialization + +```go +client := apipolicy.NewApiPolicyClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApiPolicyClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := apipolicy.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +payload := apipolicy.PolicyContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, apipolicy.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiPolicyClient.Delete` + +```go +ctx := context.TODO() +id := apipolicy.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +read, err := client.Delete(ctx, id, apipolicy.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiPolicyClient.Get` + +```go +ctx := context.TODO() +id := apipolicy.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +read, err := client.Get(ctx, id, apipolicy.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiPolicyClient.GetEntityTag` + +```go +ctx := context.TODO() +id := apipolicy.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiPolicyClient.ListByApi` + +```go +ctx := context.TODO() +id := apipolicy.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +read, err := client.ListByApi(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/client.go new file mode 100644 index 000000000000..84c3dfec8c90 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/client.go @@ -0,0 +1,26 @@ +package apipolicy + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiPolicyClient struct { + Client *resourcemanager.Client +} + +func NewApiPolicyClientWithBaseURI(sdkApi sdkEnv.Api) (*ApiPolicyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "apipolicy", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiPolicyClient: %+v", err) + } + + return &ApiPolicyClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/constants.go new file mode 100644 index 000000000000..3a402942dd85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/constants.go @@ -0,0 +1,98 @@ +package apipolicy + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyContentFormat string + +const ( + PolicyContentFormatRawxml PolicyContentFormat = "rawxml" + PolicyContentFormatRawxmlNegativelink PolicyContentFormat = "rawxml-link" + PolicyContentFormatXml PolicyContentFormat = "xml" + PolicyContentFormatXmlNegativelink PolicyContentFormat = "xml-link" +) + +func PossibleValuesForPolicyContentFormat() []string { + return []string{ + string(PolicyContentFormatRawxml), + string(PolicyContentFormatRawxmlNegativelink), + string(PolicyContentFormatXml), + string(PolicyContentFormatXmlNegativelink), + } +} + +func (s *PolicyContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePolicyContentFormat(input string) (*PolicyContentFormat, error) { + vals := map[string]PolicyContentFormat{ + "rawxml": PolicyContentFormatRawxml, + "rawxml-link": PolicyContentFormatRawxmlNegativelink, + "xml": PolicyContentFormatXml, + "xml-link": PolicyContentFormatXmlNegativelink, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyContentFormat(input) + return &out, nil +} + +type PolicyExportFormat string + +const ( + PolicyExportFormatRawxml PolicyExportFormat = "rawxml" + PolicyExportFormatXml PolicyExportFormat = "xml" +) + +func PossibleValuesForPolicyExportFormat() []string { + return []string{ + string(PolicyExportFormatRawxml), + string(PolicyExportFormatXml), + } +} + +func (s *PolicyExportFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyExportFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePolicyExportFormat(input string) (*PolicyExportFormat, error) { + vals := map[string]PolicyExportFormat{ + "rawxml": PolicyExportFormatRawxml, + "xml": PolicyExportFormatXml, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyExportFormat(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/id_api.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/id_api.go new file mode 100644 index 000000000000..fa2aa4893ac4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/id_api.go @@ -0,0 +1,140 @@ +package apipolicy + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApiId{} + +// ApiId is a struct representing the Resource ID for a Api +type ApiId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string +} + +// NewApiID returns a new ApiId struct +func NewApiID(subscriptionId string, resourceGroupName string, serviceName string, apiId string) ApiId { + return ApiId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + } +} + +// ParseApiID parses 'input' into a ApiId +func ParseApiID(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ParseApiIDInsensitively parses 'input' case-insensitively into a ApiId +// note: this method should only be used for API response data and not user input +func ParseApiIDInsensitively(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ValidateApiID checks that 'input' can be parsed as a Api ID +func ValidateApiID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApiID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api ID +func (id ApiId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api ID +func (id ApiId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + } +} + +// String returns a human-readable description of this Api ID +func (id ApiId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + } + return fmt.Sprintf("Api (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_createorupdate.go new file mode 100644 index 000000000000..34932d9e40b6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_createorupdate.go @@ -0,0 +1,85 @@ +package apipolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiPolicyClient) CreateOrUpdate(ctx context.Context, id ApiId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_delete.go new file mode 100644 index 000000000000..10b8c3c63c05 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_delete.go @@ -0,0 +1,76 @@ +package apipolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiPolicyClient) Delete(ctx context.Context, id ApiId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_get.go new file mode 100644 index 000000000000..aaa7b1d2c786 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_get.go @@ -0,0 +1,80 @@ +package apipolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type GetOperationOptions struct { + Format *PolicyExportFormat +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + return &out +} + +// Get ... +func (c ApiPolicyClient) Get(ctx context.Context, id ApiId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_getentitytag.go new file mode 100644 index 000000000000..5ab255150b8e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_getentitytag.go @@ -0,0 +1,47 @@ +package apipolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiPolicyClient) GetEntityTag(ctx context.Context, id ApiId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_listbyapi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_listbyapi.go new file mode 100644 index 000000000000..5afb8149c875 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/method_listbyapi.go @@ -0,0 +1,52 @@ +package apipolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyCollection +} + +// ListByApi ... +func (c ApiPolicyClient) ListByApi(ctx context.Context, id ApiId) (result ListByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/model_policycollection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/model_policycollection.go new file mode 100644 index 000000000000..f565c6d6b92f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/model_policycollection.go @@ -0,0 +1,10 @@ +package apipolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyCollection struct { + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]PolicyContract `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/model_policycontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/model_policycontract.go new file mode 100644 index 000000000000..e44856ff27f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/model_policycontract.go @@ -0,0 +1,11 @@ +package apipolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PolicyContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/model_policycontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/model_policycontractproperties.go new file mode 100644 index 000000000000..3ffd1c627e8c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/model_policycontractproperties.go @@ -0,0 +1,9 @@ +package apipolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyContractProperties struct { + Format *PolicyContentFormat `json:"format,omitempty"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/version.go new file mode 100644 index 000000000000..b841b22351d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy/version.go @@ -0,0 +1,12 @@ +package apipolicy + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/apipolicy/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/README.md new file mode 100644 index 000000000000..da2143d8c238 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease` Documentation + +The `apirelease` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease" +``` + + +### Client Initialization + +```go +client := apirelease.NewApiReleaseClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApiReleaseClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := apirelease.NewReleaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "releaseIdValue") + +payload := apirelease.ApiReleaseContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, apirelease.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiReleaseClient.Delete` + +```go +ctx := context.TODO() +id := apirelease.NewReleaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "releaseIdValue") + +read, err := client.Delete(ctx, id, apirelease.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiReleaseClient.Get` + +```go +ctx := context.TODO() +id := apirelease.NewReleaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "releaseIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiReleaseClient.GetEntityTag` + +```go +ctx := context.TODO() +id := apirelease.NewReleaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "releaseIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiReleaseClient.ListByService` + +```go +ctx := context.TODO() +id := apirelease.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +// alternatively `client.ListByService(ctx, id, apirelease.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, apirelease.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ApiReleaseClient.Update` + +```go +ctx := context.TODO() +id := apirelease.NewReleaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "releaseIdValue") + +payload := apirelease.ApiReleaseContract{ + // ... +} + + +read, err := client.Update(ctx, id, payload, apirelease.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/client.go new file mode 100644 index 000000000000..5ce0c50057f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/client.go @@ -0,0 +1,26 @@ +package apirelease + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiReleaseClient struct { + Client *resourcemanager.Client +} + +func NewApiReleaseClientWithBaseURI(sdkApi sdkEnv.Api) (*ApiReleaseClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "apirelease", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiReleaseClient: %+v", err) + } + + return &ApiReleaseClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/id_api.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/id_api.go new file mode 100644 index 000000000000..2859d3f4219c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/id_api.go @@ -0,0 +1,140 @@ +package apirelease + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApiId{} + +// ApiId is a struct representing the Resource ID for a Api +type ApiId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string +} + +// NewApiID returns a new ApiId struct +func NewApiID(subscriptionId string, resourceGroupName string, serviceName string, apiId string) ApiId { + return ApiId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + } +} + +// ParseApiID parses 'input' into a ApiId +func ParseApiID(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ParseApiIDInsensitively parses 'input' case-insensitively into a ApiId +// note: this method should only be used for API response data and not user input +func ParseApiIDInsensitively(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ValidateApiID checks that 'input' can be parsed as a Api ID +func ValidateApiID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApiID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api ID +func (id ApiId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api ID +func (id ApiId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + } +} + +// String returns a human-readable description of this Api ID +func (id ApiId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + } + return fmt.Sprintf("Api (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/id_release.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/id_release.go new file mode 100644 index 000000000000..a05148dd45c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/id_release.go @@ -0,0 +1,153 @@ +package apirelease + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ReleaseId{} + +// ReleaseId is a struct representing the Resource ID for a Release +type ReleaseId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string + ReleaseId string +} + +// NewReleaseID returns a new ReleaseId struct +func NewReleaseID(subscriptionId string, resourceGroupName string, serviceName string, apiId string, releaseId string) ReleaseId { + return ReleaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + ReleaseId: releaseId, + } +} + +// ParseReleaseID parses 'input' into a ReleaseId +func ParseReleaseID(input string) (*ReleaseId, error) { + parser := resourceids.NewParserFromResourceIdType(ReleaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ReleaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.ReleaseId, ok = parsed.Parsed["releaseId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "releaseId", *parsed) + } + + return &id, nil +} + +// ParseReleaseIDInsensitively parses 'input' case-insensitively into a ReleaseId +// note: this method should only be used for API response data and not user input +func ParseReleaseIDInsensitively(input string) (*ReleaseId, error) { + parser := resourceids.NewParserFromResourceIdType(ReleaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ReleaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.ReleaseId, ok = parsed.Parsed["releaseId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "releaseId", *parsed) + } + + return &id, nil +} + +// ValidateReleaseID checks that 'input' can be parsed as a Release ID +func ValidateReleaseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseReleaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Release ID +func (id ReleaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s/releases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId, id.ReleaseId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Release ID +func (id ReleaseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + resourceids.StaticSegment("staticReleases", "releases", "releases"), + resourceids.UserSpecifiedSegment("releaseId", "releaseIdValue"), + } +} + +// String returns a human-readable description of this Release ID +func (id ReleaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + fmt.Sprintf("Release: %q", id.ReleaseId), + } + return fmt.Sprintf("Release (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_createorupdate.go new file mode 100644 index 000000000000..406976fb2f8c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_createorupdate.go @@ -0,0 +1,85 @@ +package apirelease + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiReleaseContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiReleaseClient) CreateOrUpdate(ctx context.Context, id ReleaseId, input ApiReleaseContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_delete.go new file mode 100644 index 000000000000..cdfaf120b2bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_delete.go @@ -0,0 +1,76 @@ +package apirelease + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiReleaseClient) Delete(ctx context.Context, id ReleaseId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_get.go new file mode 100644 index 000000000000..afe7107ae459 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_get.go @@ -0,0 +1,51 @@ +package apirelease + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiReleaseContract +} + +// Get ... +func (c ApiReleaseClient) Get(ctx context.Context, id ReleaseId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_getentitytag.go new file mode 100644 index 000000000000..97a2ff54ef11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_getentitytag.go @@ -0,0 +1,46 @@ +package apirelease + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiReleaseClient) GetEntityTag(ctx context.Context, id ReleaseId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_listbyservice.go new file mode 100644 index 000000000000..ffb1a5e65b4d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_listbyservice.go @@ -0,0 +1,125 @@ +package apirelease + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiReleaseContract +} + +type ListByServiceCompleteResult struct { + Items []ApiReleaseContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiReleaseClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/releases", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiReleaseContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiReleaseClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiReleaseContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiReleaseClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate ApiReleaseContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ApiReleaseContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_update.go new file mode 100644 index 000000000000..23af82628f62 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/method_update.go @@ -0,0 +1,84 @@ +package apirelease + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiReleaseContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiReleaseClient) Update(ctx context.Context, id ReleaseId, input ApiReleaseContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/model_apireleasecontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/model_apireleasecontract.go new file mode 100644 index 000000000000..fae993ebed59 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/model_apireleasecontract.go @@ -0,0 +1,11 @@ +package apirelease + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiReleaseContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ApiReleaseContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/model_apireleasecontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/model_apireleasecontractproperties.go new file mode 100644 index 000000000000..56b6fec96ca4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/model_apireleasecontractproperties.go @@ -0,0 +1,41 @@ +package apirelease + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiReleaseContractProperties struct { + ApiId *string `json:"apiId,omitempty"` + CreatedDateTime *string `json:"createdDateTime,omitempty"` + Notes *string `json:"notes,omitempty"` + UpdatedDateTime *string `json:"updatedDateTime,omitempty"` +} + +func (o *ApiReleaseContractProperties) GetCreatedDateTimeAsTime() (*time.Time, error) { + if o.CreatedDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ApiReleaseContractProperties) SetCreatedDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedDateTime = &formatted +} + +func (o *ApiReleaseContractProperties) GetUpdatedDateTimeAsTime() (*time.Time, error) { + if o.UpdatedDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpdatedDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ApiReleaseContractProperties) SetUpdatedDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpdatedDateTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/predicates.go new file mode 100644 index 000000000000..975276126379 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/predicates.go @@ -0,0 +1,27 @@ +package apirelease + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiReleaseContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ApiReleaseContractOperationPredicate) Matches(input ApiReleaseContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/version.go new file mode 100644 index 000000000000..556230cf3153 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease/version.go @@ -0,0 +1,12 @@ +package apirelease + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/apirelease/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/README.md new file mode 100644 index 000000000000..669627e8ea8d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/README.md @@ -0,0 +1,102 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema` Documentation + +The `apischema` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema" +``` + + +### Client Initialization + +```go +client := apischema.NewApiSchemaClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApiSchemaClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := apischema.NewApiSchemaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "schemaIdValue") + +payload := apischema.SchemaContract{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload, apischema.DefaultCreateOrUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `ApiSchemaClient.Delete` + +```go +ctx := context.TODO() +id := apischema.NewApiSchemaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "schemaIdValue") + +read, err := client.Delete(ctx, id, apischema.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiSchemaClient.Get` + +```go +ctx := context.TODO() +id := apischema.NewApiSchemaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "schemaIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiSchemaClient.GetEntityTag` + +```go +ctx := context.TODO() +id := apischema.NewApiSchemaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "schemaIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiSchemaClient.ListByApi` + +```go +ctx := context.TODO() +id := apischema.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +// alternatively `client.ListByApi(ctx, id, apischema.DefaultListByApiOperationOptions())` can be used to do batched pagination +items, err := client.ListByApiComplete(ctx, id, apischema.DefaultListByApiOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/client.go new file mode 100644 index 000000000000..fb466515328c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/client.go @@ -0,0 +1,26 @@ +package apischema + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiSchemaClient struct { + Client *resourcemanager.Client +} + +func NewApiSchemaClientWithBaseURI(sdkApi sdkEnv.Api) (*ApiSchemaClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "apischema", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiSchemaClient: %+v", err) + } + + return &ApiSchemaClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/id_api.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/id_api.go new file mode 100644 index 000000000000..f58e6b3b0fd7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/id_api.go @@ -0,0 +1,140 @@ +package apischema + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApiId{} + +// ApiId is a struct representing the Resource ID for a Api +type ApiId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string +} + +// NewApiID returns a new ApiId struct +func NewApiID(subscriptionId string, resourceGroupName string, serviceName string, apiId string) ApiId { + return ApiId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + } +} + +// ParseApiID parses 'input' into a ApiId +func ParseApiID(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ParseApiIDInsensitively parses 'input' case-insensitively into a ApiId +// note: this method should only be used for API response data and not user input +func ParseApiIDInsensitively(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ValidateApiID checks that 'input' can be parsed as a Api ID +func ValidateApiID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApiID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api ID +func (id ApiId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api ID +func (id ApiId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + } +} + +// String returns a human-readable description of this Api ID +func (id ApiId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + } + return fmt.Sprintf("Api (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/id_apischema.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/id_apischema.go new file mode 100644 index 000000000000..13017418f0ca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/id_apischema.go @@ -0,0 +1,153 @@ +package apischema + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApiSchemaId{} + +// ApiSchemaId is a struct representing the Resource ID for a Api Schema +type ApiSchemaId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string + SchemaId string +} + +// NewApiSchemaID returns a new ApiSchemaId struct +func NewApiSchemaID(subscriptionId string, resourceGroupName string, serviceName string, apiId string, schemaId string) ApiSchemaId { + return ApiSchemaId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + SchemaId: schemaId, + } +} + +// ParseApiSchemaID parses 'input' into a ApiSchemaId +func ParseApiSchemaID(input string) (*ApiSchemaId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiSchemaId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiSchemaId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + } + + return &id, nil +} + +// ParseApiSchemaIDInsensitively parses 'input' case-insensitively into a ApiSchemaId +// note: this method should only be used for API response data and not user input +func ParseApiSchemaIDInsensitively(input string) (*ApiSchemaId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiSchemaId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiSchemaId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + } + + return &id, nil +} + +// ValidateApiSchemaID checks that 'input' can be parsed as a Api Schema ID +func ValidateApiSchemaID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApiSchemaID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api Schema ID +func (id ApiSchemaId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s/schemas/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId, id.SchemaId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api Schema ID +func (id ApiSchemaId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + resourceids.StaticSegment("staticSchemas", "schemas", "schemas"), + resourceids.UserSpecifiedSegment("schemaId", "schemaIdValue"), + } +} + +// String returns a human-readable description of this Api Schema ID +func (id ApiSchemaId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + fmt.Sprintf("Schema: %q", id.SchemaId), + } + return fmt.Sprintf("Api Schema (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_createorupdate.go new file mode 100644 index 000000000000..ee50a77ff43d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_createorupdate.go @@ -0,0 +1,103 @@ +package apischema + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiSchemaClient) CreateOrUpdate(ctx context.Context, id ApiSchemaId, input SchemaContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ApiSchemaClient) CreateOrUpdateThenPoll(ctx context.Context, id ApiSchemaId, input SchemaContract, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_delete.go new file mode 100644 index 000000000000..6fab69145736 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_delete.go @@ -0,0 +1,79 @@ +package apischema + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + Force *bool + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Force != nil { + out.Append("force", fmt.Sprintf("%v", *o.Force)) + } + return &out +} + +// Delete ... +func (c ApiSchemaClient) Delete(ctx context.Context, id ApiSchemaId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_get.go new file mode 100644 index 000000000000..544b5401b16c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_get.go @@ -0,0 +1,51 @@ +package apischema + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SchemaContract +} + +// Get ... +func (c ApiSchemaClient) Get(ctx context.Context, id ApiSchemaId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_getentitytag.go new file mode 100644 index 000000000000..06aa5ede3ba6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_getentitytag.go @@ -0,0 +1,46 @@ +package apischema + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiSchemaClient) GetEntityTag(ctx context.Context, id ApiSchemaId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_listbyapi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_listbyapi.go new file mode 100644 index 000000000000..8486736bbe24 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/method_listbyapi.go @@ -0,0 +1,125 @@ +package apischema + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SchemaContract +} + +type ListByApiCompleteResult struct { + Items []SchemaContract +} + +type ListByApiOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByApiOperationOptions() ListByApiOperationOptions { + return ListByApiOperationOptions{} +} + +func (o ListByApiOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByApiOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByApiOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByApi ... +func (c ApiSchemaClient) ListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (result ListByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/schemas", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SchemaContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByApiComplete retrieves all the results into a single object +func (c ApiSchemaClient) ListByApiComplete(ctx context.Context, id ApiId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { + return c.ListByApiCompleteMatchingPredicate(ctx, id, options, SchemaContractOperationPredicate{}) +} + +// ListByApiCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiSchemaClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApiOperationOptions, predicate SchemaContractOperationPredicate) (result ListByApiCompleteResult, err error) { + items := make([]SchemaContract, 0) + + resp, err := c.ListByApi(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByApiCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/model_schemacontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/model_schemacontract.go new file mode 100644 index 000000000000..784220164fd2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/model_schemacontract.go @@ -0,0 +1,11 @@ +package apischema + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchemaContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SchemaContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/model_schemacontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/model_schemacontractproperties.go new file mode 100644 index 000000000000..1e90280f3983 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/model_schemacontractproperties.go @@ -0,0 +1,9 @@ +package apischema + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchemaContractProperties struct { + ContentType string `json:"contentType"` + Document *SchemaDocumentProperties `json:"document,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/model_schemadocumentproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/model_schemadocumentproperties.go new file mode 100644 index 000000000000..bf00fb63435e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/model_schemadocumentproperties.go @@ -0,0 +1,10 @@ +package apischema + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchemaDocumentProperties struct { + Components *interface{} `json:"components,omitempty"` + Definitions *interface{} `json:"definitions,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/predicates.go new file mode 100644 index 000000000000..2805a46671c0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/predicates.go @@ -0,0 +1,27 @@ +package apischema + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchemaContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SchemaContractOperationPredicate) Matches(input SchemaContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/version.go new file mode 100644 index 000000000000..0e43e31ea332 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema/version.go @@ -0,0 +1,12 @@ +package apischema + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/apischema/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/README.md new file mode 100644 index 000000000000..8ca46109bae5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/README.md @@ -0,0 +1,101 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag` Documentation + +The `apitag` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag" +``` + + +### Client Initialization + +```go +client := apitag.NewApiTagClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApiTagClient.TagAssignToApi` + +```go +ctx := context.TODO() +id := apitag.NewApiTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "tagIdValue") + +read, err := client.TagAssignToApi(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiTagClient.TagDetachFromApi` + +```go +ctx := context.TODO() +id := apitag.NewApiTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "tagIdValue") + +read, err := client.TagDetachFromApi(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiTagClient.TagGetByApi` + +```go +ctx := context.TODO() +id := apitag.NewApiTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "tagIdValue") + +read, err := client.TagGetByApi(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiTagClient.TagGetEntityStateByApi` + +```go +ctx := context.TODO() +id := apitag.NewApiTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "tagIdValue") + +read, err := client.TagGetEntityStateByApi(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiTagClient.TagListByApi` + +```go +ctx := context.TODO() +id := apitag.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +// alternatively `client.TagListByApi(ctx, id, apitag.DefaultTagListByApiOperationOptions())` can be used to do batched pagination +items, err := client.TagListByApiComplete(ctx, id, apitag.DefaultTagListByApiOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/client.go new file mode 100644 index 000000000000..491411cb3467 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/client.go @@ -0,0 +1,26 @@ +package apitag + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiTagClient struct { + Client *resourcemanager.Client +} + +func NewApiTagClientWithBaseURI(sdkApi sdkEnv.Api) (*ApiTagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "apitag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiTagClient: %+v", err) + } + + return &ApiTagClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/id_api.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/id_api.go new file mode 100644 index 000000000000..89fbccee1e65 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/id_api.go @@ -0,0 +1,140 @@ +package apitag + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApiId{} + +// ApiId is a struct representing the Resource ID for a Api +type ApiId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string +} + +// NewApiID returns a new ApiId struct +func NewApiID(subscriptionId string, resourceGroupName string, serviceName string, apiId string) ApiId { + return ApiId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + } +} + +// ParseApiID parses 'input' into a ApiId +func ParseApiID(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ParseApiIDInsensitively parses 'input' case-insensitively into a ApiId +// note: this method should only be used for API response data and not user input +func ParseApiIDInsensitively(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ValidateApiID checks that 'input' can be parsed as a Api ID +func ValidateApiID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApiID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api ID +func (id ApiId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api ID +func (id ApiId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + } +} + +// String returns a human-readable description of this Api ID +func (id ApiId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + } + return fmt.Sprintf("Api (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/id_apitag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/id_apitag.go new file mode 100644 index 000000000000..065dee9d7dfa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/id_apitag.go @@ -0,0 +1,153 @@ +package apitag + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApiTagId{} + +// ApiTagId is a struct representing the Resource ID for a Api Tag +type ApiTagId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string + TagId string +} + +// NewApiTagID returns a new ApiTagId struct +func NewApiTagID(subscriptionId string, resourceGroupName string, serviceName string, apiId string, tagId string) ApiTagId { + return ApiTagId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + TagId: tagId, + } +} + +// ParseApiTagID parses 'input' into a ApiTagId +func ParseApiTagID(input string) (*ApiTagId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiTagId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiTagId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.TagId, ok = parsed.Parsed["tagId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + } + + return &id, nil +} + +// ParseApiTagIDInsensitively parses 'input' case-insensitively into a ApiTagId +// note: this method should only be used for API response data and not user input +func ParseApiTagIDInsensitively(input string) (*ApiTagId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiTagId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiTagId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.TagId, ok = parsed.Parsed["tagId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + } + + return &id, nil +} + +// ValidateApiTagID checks that 'input' can be parsed as a Api Tag ID +func ValidateApiTagID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApiTagID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api Tag ID +func (id ApiTagId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s/tags/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId, id.TagId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api Tag ID +func (id ApiTagId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + resourceids.StaticSegment("staticTags", "tags", "tags"), + resourceids.UserSpecifiedSegment("tagId", "tagIdValue"), + } +} + +// String returns a human-readable description of this Api Tag ID +func (id ApiTagId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + fmt.Sprintf("Tag: %q", id.TagId), + } + return fmt.Sprintf("Api Tag (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_tagassigntoapi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_tagassigntoapi.go new file mode 100644 index 000000000000..96c964a74bd9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_tagassigntoapi.go @@ -0,0 +1,52 @@ +package apitag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagAssignToApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagAssignToApi ... +func (c ApiTagClient) TagAssignToApi(ctx context.Context, id ApiTagId) (result TagAssignToApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_tagdetachfromapi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_tagdetachfromapi.go new file mode 100644 index 000000000000..ad546cf7c3c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_tagdetachfromapi.go @@ -0,0 +1,47 @@ +package apitag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagDetachFromApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagDetachFromApi ... +func (c ApiTagClient) TagDetachFromApi(ctx context.Context, id ApiTagId) (result TagDetachFromApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_taggetbyapi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_taggetbyapi.go new file mode 100644 index 000000000000..97876d1178c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_taggetbyapi.go @@ -0,0 +1,51 @@ +package apitag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagGetByApi ... +func (c ApiTagClient) TagGetByApi(ctx context.Context, id ApiTagId) (result TagGetByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_taggetentitystatebyapi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_taggetentitystatebyapi.go new file mode 100644 index 000000000000..eb833e96b2ac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_taggetentitystatebyapi.go @@ -0,0 +1,46 @@ +package apitag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetEntityStateByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagGetEntityStateByApi ... +func (c ApiTagClient) TagGetEntityStateByApi(ctx context.Context, id ApiTagId) (result TagGetEntityStateByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_taglistbyapi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_taglistbyapi.go new file mode 100644 index 000000000000..9ab4d2bb22ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/method_taglistbyapi.go @@ -0,0 +1,125 @@ +package apitag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagListByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagContract +} + +type TagListByApiCompleteResult struct { + Items []TagContract +} + +type TagListByApiOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultTagListByApiOperationOptions() TagListByApiOperationOptions { + return TagListByApiOperationOptions{} +} + +func (o TagListByApiOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o TagListByApiOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o TagListByApiOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// TagListByApi ... +func (c ApiTagClient) TagListByApi(ctx context.Context, id ApiId, options TagListByApiOperationOptions) (result TagListByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// TagListByApiComplete retrieves all the results into a single object +func (c ApiTagClient) TagListByApiComplete(ctx context.Context, id ApiId, options TagListByApiOperationOptions) (TagListByApiCompleteResult, error) { + return c.TagListByApiCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) +} + +// TagListByApiCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiTagClient) TagListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options TagListByApiOperationOptions, predicate TagContractOperationPredicate) (result TagListByApiCompleteResult, err error) { + items := make([]TagContract, 0) + + resp, err := c.TagListByApi(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = TagListByApiCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/model_tagcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/model_tagcontract.go new file mode 100644 index 000000000000..3bcb3a6a462b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/model_tagcontract.go @@ -0,0 +1,11 @@ +package apitag + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *TagContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/model_tagcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/model_tagcontractproperties.go new file mode 100644 index 000000000000..4c79cb720eb2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/model_tagcontractproperties.go @@ -0,0 +1,8 @@ +package apitag + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagContractProperties struct { + DisplayName string `json:"displayName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/predicates.go new file mode 100644 index 000000000000..4123a26d8859 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/predicates.go @@ -0,0 +1,27 @@ +package apitag + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p TagContractOperationPredicate) Matches(input TagContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/version.go new file mode 100644 index 000000000000..4af227f028d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag/version.go @@ -0,0 +1,12 @@ +package apitag + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/apitag/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/README.md new file mode 100644 index 000000000000..fcd58e4c7c8d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/README.md @@ -0,0 +1,106 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription` Documentation + +The `apitagdescription` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription" +``` + + +### Client Initialization + +```go +client := apitagdescription.NewApiTagDescriptionClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApiTagDescriptionClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := apitagdescription.NewTagDescriptionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "tagDescriptionIdValue") + +payload := apitagdescription.TagDescriptionCreateParameters{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, apitagdescription.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiTagDescriptionClient.Delete` + +```go +ctx := context.TODO() +id := apitagdescription.NewTagDescriptionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "tagDescriptionIdValue") + +read, err := client.Delete(ctx, id, apitagdescription.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiTagDescriptionClient.Get` + +```go +ctx := context.TODO() +id := apitagdescription.NewTagDescriptionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "tagDescriptionIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiTagDescriptionClient.GetEntityTag` + +```go +ctx := context.TODO() +id := apitagdescription.NewTagDescriptionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue", "tagDescriptionIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiTagDescriptionClient.ListByService` + +```go +ctx := context.TODO() +id := apitagdescription.NewApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "apiIdValue") + +// alternatively `client.ListByService(ctx, id, apitagdescription.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, apitagdescription.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/client.go new file mode 100644 index 000000000000..f3068aee44a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/client.go @@ -0,0 +1,26 @@ +package apitagdescription + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiTagDescriptionClient struct { + Client *resourcemanager.Client +} + +func NewApiTagDescriptionClientWithBaseURI(sdkApi sdkEnv.Api) (*ApiTagDescriptionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "apitagdescription", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiTagDescriptionClient: %+v", err) + } + + return &ApiTagDescriptionClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/id_api.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/id_api.go new file mode 100644 index 000000000000..7b00f6d8314b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/id_api.go @@ -0,0 +1,140 @@ +package apitagdescription + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApiId{} + +// ApiId is a struct representing the Resource ID for a Api +type ApiId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string +} + +// NewApiID returns a new ApiId struct +func NewApiID(subscriptionId string, resourceGroupName string, serviceName string, apiId string) ApiId { + return ApiId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + } +} + +// ParseApiID parses 'input' into a ApiId +func ParseApiID(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ParseApiIDInsensitively parses 'input' case-insensitively into a ApiId +// note: this method should only be used for API response data and not user input +func ParseApiIDInsensitively(input string) (*ApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ValidateApiID checks that 'input' can be parsed as a Api ID +func ValidateApiID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApiID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api ID +func (id ApiId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api ID +func (id ApiId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + } +} + +// String returns a human-readable description of this Api ID +func (id ApiId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + } + return fmt.Sprintf("Api (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/id_tagdescription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/id_tagdescription.go new file mode 100644 index 000000000000..4ac4fb2acef1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/id_tagdescription.go @@ -0,0 +1,153 @@ +package apitagdescription + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = TagDescriptionId{} + +// TagDescriptionId is a struct representing the Resource ID for a Tag Description +type TagDescriptionId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ApiId string + TagDescriptionId string +} + +// NewTagDescriptionID returns a new TagDescriptionId struct +func NewTagDescriptionID(subscriptionId string, resourceGroupName string, serviceName string, apiId string, tagDescriptionId string) TagDescriptionId { + return TagDescriptionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ApiId: apiId, + TagDescriptionId: tagDescriptionId, + } +} + +// ParseTagDescriptionID parses 'input' into a TagDescriptionId +func ParseTagDescriptionID(input string) (*TagDescriptionId, error) { + parser := resourceids.NewParserFromResourceIdType(TagDescriptionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TagDescriptionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.TagDescriptionId, ok = parsed.Parsed["tagDescriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagDescriptionId", *parsed) + } + + return &id, nil +} + +// ParseTagDescriptionIDInsensitively parses 'input' case-insensitively into a TagDescriptionId +// note: this method should only be used for API response data and not user input +func ParseTagDescriptionIDInsensitively(input string) (*TagDescriptionId, error) { + parser := resourceids.NewParserFromResourceIdType(TagDescriptionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TagDescriptionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + if id.TagDescriptionId, ok = parsed.Parsed["tagDescriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagDescriptionId", *parsed) + } + + return &id, nil +} + +// ValidateTagDescriptionID checks that 'input' can be parsed as a Tag Description ID +func ValidateTagDescriptionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseTagDescriptionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Tag Description ID +func (id TagDescriptionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apis/%s/tagDescriptions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ApiId, id.TagDescriptionId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Tag Description ID +func (id TagDescriptionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + resourceids.StaticSegment("staticTagDescriptions", "tagDescriptions", "tagDescriptions"), + resourceids.UserSpecifiedSegment("tagDescriptionId", "tagDescriptionIdValue"), + } +} + +// String returns a human-readable description of this Tag Description ID +func (id TagDescriptionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Api: %q", id.ApiId), + fmt.Sprintf("Tag Description: %q", id.TagDescriptionId), + } + return fmt.Sprintf("Tag Description (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_createorupdate.go new file mode 100644 index 000000000000..08f839f5fe52 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_createorupdate.go @@ -0,0 +1,85 @@ +package apitagdescription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagDescriptionContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiTagDescriptionClient) CreateOrUpdate(ctx context.Context, id TagDescriptionId, input TagDescriptionCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_delete.go new file mode 100644 index 000000000000..bc50e1495af9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_delete.go @@ -0,0 +1,76 @@ +package apitagdescription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiTagDescriptionClient) Delete(ctx context.Context, id TagDescriptionId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_get.go new file mode 100644 index 000000000000..b4eb50d639b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_get.go @@ -0,0 +1,51 @@ +package apitagdescription + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagDescriptionContract +} + +// Get ... +func (c ApiTagDescriptionClient) Get(ctx context.Context, id TagDescriptionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_getentitytag.go new file mode 100644 index 000000000000..1db8e6e13d4c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_getentitytag.go @@ -0,0 +1,46 @@ +package apitagdescription + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiTagDescriptionClient) GetEntityTag(ctx context.Context, id TagDescriptionId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_listbyservice.go new file mode 100644 index 000000000000..ccc6ebbef035 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/method_listbyservice.go @@ -0,0 +1,125 @@ +package apitagdescription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagDescriptionContract +} + +type ListByServiceCompleteResult struct { + Items []TagDescriptionContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiTagDescriptionClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tagDescriptions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagDescriptionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiTagDescriptionClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TagDescriptionContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiTagDescriptionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate TagDescriptionContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]TagDescriptionContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptionbaseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptionbaseproperties.go new file mode 100644 index 000000000000..cb5c534f1af2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptionbaseproperties.go @@ -0,0 +1,10 @@ +package apitagdescription + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagDescriptionBaseProperties struct { + Description *string `json:"description,omitempty"` + ExternalDocsDescription *string `json:"externalDocsDescription,omitempty"` + ExternalDocsUrl *string `json:"externalDocsUrl,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptioncontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptioncontract.go new file mode 100644 index 000000000000..c18f35390757 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptioncontract.go @@ -0,0 +1,11 @@ +package apitagdescription + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagDescriptionContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *TagDescriptionContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptioncontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptioncontractproperties.go new file mode 100644 index 000000000000..071eefae7d3e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptioncontractproperties.go @@ -0,0 +1,12 @@ +package apitagdescription + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagDescriptionContractProperties struct { + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + ExternalDocsDescription *string `json:"externalDocsDescription,omitempty"` + ExternalDocsUrl *string `json:"externalDocsUrl,omitempty"` + TagId *string `json:"tagId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptioncreateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptioncreateparameters.go new file mode 100644 index 000000000000..405c7b46c9c9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/model_tagdescriptioncreateparameters.go @@ -0,0 +1,8 @@ +package apitagdescription + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagDescriptionCreateParameters struct { + Properties *TagDescriptionBaseProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/predicates.go new file mode 100644 index 000000000000..e42faf26df93 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/predicates.go @@ -0,0 +1,27 @@ +package apitagdescription + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagDescriptionContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p TagDescriptionContractOperationPredicate) Matches(input TagDescriptionContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/version.go new file mode 100644 index 000000000000..43118f279b8c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription/version.go @@ -0,0 +1,12 @@ +package apitagdescription + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/apitagdescription/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/README.md new file mode 100644 index 000000000000..2f85d6c877a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset` Documentation + +The `apiversionset` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset" +``` + + +### Client Initialization + +```go +client := apiversionset.NewApiVersionSetClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApiVersionSetClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := apiversionset.NewApiVersionSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "versionSetIdValue") + +payload := apiversionset.ApiVersionSetContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, apiversionset.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiVersionSetClient.Get` + +```go +ctx := context.TODO() +id := apiversionset.NewApiVersionSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "versionSetIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiVersionSetClient.GetEntityTag` + +```go +ctx := context.TODO() +id := apiversionset.NewApiVersionSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "versionSetIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiVersionSetClient.ListByService` + +```go +ctx := context.TODO() +id := apiversionset.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, apiversionset.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, apiversionset.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ApiVersionSetClient.Update` + +```go +ctx := context.TODO() +id := apiversionset.NewApiVersionSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "versionSetIdValue") + +payload := apiversionset.ApiVersionSetUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload, apiversionset.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/client.go new file mode 100644 index 000000000000..ff0c4d18fb02 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/client.go @@ -0,0 +1,26 @@ +package apiversionset + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiVersionSetClient struct { + Client *resourcemanager.Client +} + +func NewApiVersionSetClientWithBaseURI(sdkApi sdkEnv.Api) (*ApiVersionSetClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "apiversionset", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiVersionSetClient: %+v", err) + } + + return &ApiVersionSetClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/constants.go new file mode 100644 index 000000000000..4fb4d169fff5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/constants.go @@ -0,0 +1,54 @@ +package apiversionset + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VersioningScheme string + +const ( + VersioningSchemeHeader VersioningScheme = "Header" + VersioningSchemeQuery VersioningScheme = "Query" + VersioningSchemeSegment VersioningScheme = "Segment" +) + +func PossibleValuesForVersioningScheme() []string { + return []string{ + string(VersioningSchemeHeader), + string(VersioningSchemeQuery), + string(VersioningSchemeSegment), + } +} + +func (s *VersioningScheme) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVersioningScheme(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVersioningScheme(input string) (*VersioningScheme, error) { + vals := map[string]VersioningScheme{ + "header": VersioningSchemeHeader, + "query": VersioningSchemeQuery, + "segment": VersioningSchemeSegment, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VersioningScheme(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/id_apiversionset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/id_apiversionset.go new file mode 100644 index 000000000000..f541aa66a7d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/id_apiversionset.go @@ -0,0 +1,140 @@ +package apiversionset + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApiVersionSetId{} + +// ApiVersionSetId is a struct representing the Resource ID for a Api Version Set +type ApiVersionSetId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + VersionSetId string +} + +// NewApiVersionSetID returns a new ApiVersionSetId struct +func NewApiVersionSetID(subscriptionId string, resourceGroupName string, serviceName string, versionSetId string) ApiVersionSetId { + return ApiVersionSetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + VersionSetId: versionSetId, + } +} + +// ParseApiVersionSetID parses 'input' into a ApiVersionSetId +func ParseApiVersionSetID(input string) (*ApiVersionSetId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiVersionSetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiVersionSetId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + } + + return &id, nil +} + +// ParseApiVersionSetIDInsensitively parses 'input' case-insensitively into a ApiVersionSetId +// note: this method should only be used for API response data and not user input +func ParseApiVersionSetIDInsensitively(input string) (*ApiVersionSetId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiVersionSetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiVersionSetId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + } + + return &id, nil +} + +// ValidateApiVersionSetID checks that 'input' can be parsed as a Api Version Set ID +func ValidateApiVersionSetID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApiVersionSetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api Version Set ID +func (id ApiVersionSetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apiVersionSets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.VersionSetId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api Version Set ID +func (id ApiVersionSetId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApiVersionSets", "apiVersionSets", "apiVersionSets"), + resourceids.UserSpecifiedSegment("versionSetId", "versionSetIdValue"), + } +} + +// String returns a human-readable description of this Api Version Set ID +func (id ApiVersionSetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Version Set: %q", id.VersionSetId), + } + return fmt.Sprintf("Api Version Set (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/id_service.go new file mode 100644 index 000000000000..b4503adde39c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/id_service.go @@ -0,0 +1,127 @@ +package apiversionset + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_createorupdate.go new file mode 100644 index 000000000000..69f9d46f502e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_createorupdate.go @@ -0,0 +1,85 @@ +package apiversionset + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiVersionSetContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiVersionSetClient) CreateOrUpdate(ctx context.Context, id ApiVersionSetId, input ApiVersionSetContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_get.go new file mode 100644 index 000000000000..910c5a906311 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_get.go @@ -0,0 +1,51 @@ +package apiversionset + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiVersionSetContract +} + +// Get ... +func (c ApiVersionSetClient) Get(ctx context.Context, id ApiVersionSetId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_getentitytag.go new file mode 100644 index 000000000000..9f95f1e557c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_getentitytag.go @@ -0,0 +1,46 @@ +package apiversionset + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiVersionSetClient) GetEntityTag(ctx context.Context, id ApiVersionSetId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_listbyservice.go new file mode 100644 index 000000000000..c850c773f5ee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_listbyservice.go @@ -0,0 +1,125 @@ +package apiversionset + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiVersionSetContract +} + +type ListByServiceCompleteResult struct { + Items []ApiVersionSetContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiVersionSetClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/apiVersionSets", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiVersionSetContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiVersionSetClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiVersionSetContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiVersionSetClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate ApiVersionSetContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ApiVersionSetContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_update.go new file mode 100644 index 000000000000..a894808f20a8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/method_update.go @@ -0,0 +1,84 @@ +package apiversionset + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiVersionSetContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiVersionSetClient) Update(ctx context.Context, id ApiVersionSetId, input ApiVersionSetUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetcontract.go new file mode 100644 index 000000000000..8fdb4cc3e1a7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetcontract.go @@ -0,0 +1,11 @@ +package apiversionset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiVersionSetContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ApiVersionSetContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetcontractproperties.go new file mode 100644 index 000000000000..9130fed751c6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetcontractproperties.go @@ -0,0 +1,12 @@ +package apiversionset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiVersionSetContractProperties struct { + Description *string `json:"description,omitempty"` + DisplayName string `json:"displayName"` + VersionHeaderName *string `json:"versionHeaderName,omitempty"` + VersionQueryName *string `json:"versionQueryName,omitempty"` + VersioningScheme VersioningScheme `json:"versioningScheme"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetupdateparameters.go new file mode 100644 index 000000000000..4cafb4be098d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetupdateparameters.go @@ -0,0 +1,8 @@ +package apiversionset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiVersionSetUpdateParameters struct { + Properties *ApiVersionSetUpdateParametersProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetupdateparametersproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetupdateparametersproperties.go new file mode 100644 index 000000000000..733e18195de4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/model_apiversionsetupdateparametersproperties.go @@ -0,0 +1,12 @@ +package apiversionset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiVersionSetUpdateParametersProperties struct { + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + VersionHeaderName *string `json:"versionHeaderName,omitempty"` + VersionQueryName *string `json:"versionQueryName,omitempty"` + VersioningScheme *VersioningScheme `json:"versioningScheme,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/predicates.go new file mode 100644 index 000000000000..66a673e544de --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/predicates.go @@ -0,0 +1,27 @@ +package apiversionset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiVersionSetContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ApiVersionSetContractOperationPredicate) Matches(input ApiVersionSetContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/version.go new file mode 100644 index 000000000000..3ae96b77894b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset/version.go @@ -0,0 +1,12 @@ +package apiversionset + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/apiversionset/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/client.go new file mode 100644 index 000000000000..e1665dd8077a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/client.go @@ -0,0 +1,26 @@ +package apiversionsets + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiVersionSetsClient struct { + Client *resourcemanager.Client +} + +func NewApiVersionSetsClientWithBaseURI(sdkApi sdkEnv.Api) (*ApiVersionSetsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "apiversionsets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiVersionSetsClient: %+v", err) + } + + return &ApiVersionSetsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/id_apiversionset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/id_apiversionset.go new file mode 100644 index 000000000000..aa4b1218098b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/id_apiversionset.go @@ -0,0 +1,140 @@ +package apiversionsets + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ApiVersionSetId{} + +// ApiVersionSetId is a struct representing the Resource ID for a Api Version Set +type ApiVersionSetId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + VersionSetId string +} + +// NewApiVersionSetID returns a new ApiVersionSetId struct +func NewApiVersionSetID(subscriptionId string, resourceGroupName string, serviceName string, versionSetId string) ApiVersionSetId { + return ApiVersionSetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + VersionSetId: versionSetId, + } +} + +// ParseApiVersionSetID parses 'input' into a ApiVersionSetId +func ParseApiVersionSetID(input string) (*ApiVersionSetId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiVersionSetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiVersionSetId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + } + + return &id, nil +} + +// ParseApiVersionSetIDInsensitively parses 'input' case-insensitively into a ApiVersionSetId +// note: this method should only be used for API response data and not user input +func ParseApiVersionSetIDInsensitively(input string) (*ApiVersionSetId, error) { + parser := resourceids.NewParserFromResourceIdType(ApiVersionSetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApiVersionSetId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + } + + return &id, nil +} + +// ValidateApiVersionSetID checks that 'input' can be parsed as a Api Version Set ID +func ValidateApiVersionSetID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApiVersionSetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api Version Set ID +func (id ApiVersionSetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/apiVersionSets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.VersionSetId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api Version Set ID +func (id ApiVersionSetId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticApiVersionSets", "apiVersionSets", "apiVersionSets"), + resourceids.UserSpecifiedSegment("versionSetId", "versionSetIdValue"), + } +} + +// String returns a human-readable description of this Api Version Set ID +func (id ApiVersionSetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Version Set: %q", id.VersionSetId), + } + return fmt.Sprintf("Api Version Set (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/method_apiversionsetdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/method_apiversionsetdelete.go new file mode 100644 index 000000000000..f50800347d84 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/method_apiversionsetdelete.go @@ -0,0 +1,76 @@ +package apiversionsets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiVersionSetDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type ApiVersionSetDeleteOperationOptions struct { + IfMatch *string +} + +func DefaultApiVersionSetDeleteOperationOptions() ApiVersionSetDeleteOperationOptions { + return ApiVersionSetDeleteOperationOptions{} +} + +func (o ApiVersionSetDeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o ApiVersionSetDeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ApiVersionSetDeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// ApiVersionSetDelete ... +func (c ApiVersionSetsClient) ApiVersionSetDelete(ctx context.Context, id ApiVersionSetId, options ApiVersionSetDeleteOperationOptions) (result ApiVersionSetDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/version.go new file mode 100644 index 000000000000..25815780aaa8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets/version.go @@ -0,0 +1,12 @@ +package apiversionsets + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/apiversionsets/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/README.md new file mode 100644 index 000000000000..c54dc57ce5e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/README.md @@ -0,0 +1,143 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver` Documentation + +The `authorizationserver` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver" +``` + + +### Client Initialization + +```go +client := authorizationserver.NewAuthorizationServerClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AuthorizationServerClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := authorizationserver.NewAuthorizationServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "authorizationServerValue") + +payload := authorizationserver.AuthorizationServerContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, authorizationserver.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AuthorizationServerClient.Delete` + +```go +ctx := context.TODO() +id := authorizationserver.NewAuthorizationServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "authorizationServerValue") + +read, err := client.Delete(ctx, id, authorizationserver.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AuthorizationServerClient.Get` + +```go +ctx := context.TODO() +id := authorizationserver.NewAuthorizationServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "authorizationServerValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AuthorizationServerClient.GetEntityTag` + +```go +ctx := context.TODO() +id := authorizationserver.NewAuthorizationServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "authorizationServerValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AuthorizationServerClient.ListByService` + +```go +ctx := context.TODO() +id := authorizationserver.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, authorizationserver.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, authorizationserver.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AuthorizationServerClient.ListSecrets` + +```go +ctx := context.TODO() +id := authorizationserver.NewAuthorizationServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "authorizationServerValue") + +read, err := client.ListSecrets(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AuthorizationServerClient.Update` + +```go +ctx := context.TODO() +id := authorizationserver.NewAuthorizationServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "authorizationServerValue") + +payload := authorizationserver.AuthorizationServerUpdateContract{ + // ... +} + + +read, err := client.Update(ctx, id, payload, authorizationserver.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/client.go new file mode 100644 index 000000000000..a234058adb11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/client.go @@ -0,0 +1,26 @@ +package authorizationserver + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationServerClient struct { + Client *resourcemanager.Client +} + +func NewAuthorizationServerClientWithBaseURI(sdkApi sdkEnv.Api) (*AuthorizationServerClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "authorizationserver", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AuthorizationServerClient: %+v", err) + } + + return &AuthorizationServerClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/constants.go new file mode 100644 index 000000000000..135527703de8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/constants.go @@ -0,0 +1,198 @@ +package authorizationserver + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationMethod string + +const ( + AuthorizationMethodDELETE AuthorizationMethod = "DELETE" + AuthorizationMethodGET AuthorizationMethod = "GET" + AuthorizationMethodHEAD AuthorizationMethod = "HEAD" + AuthorizationMethodOPTIONS AuthorizationMethod = "OPTIONS" + AuthorizationMethodPATCH AuthorizationMethod = "PATCH" + AuthorizationMethodPOST AuthorizationMethod = "POST" + AuthorizationMethodPUT AuthorizationMethod = "PUT" + AuthorizationMethodTRACE AuthorizationMethod = "TRACE" +) + +func PossibleValuesForAuthorizationMethod() []string { + return []string{ + string(AuthorizationMethodDELETE), + string(AuthorizationMethodGET), + string(AuthorizationMethodHEAD), + string(AuthorizationMethodOPTIONS), + string(AuthorizationMethodPATCH), + string(AuthorizationMethodPOST), + string(AuthorizationMethodPUT), + string(AuthorizationMethodTRACE), + } +} + +func (s *AuthorizationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAuthorizationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAuthorizationMethod(input string) (*AuthorizationMethod, error) { + vals := map[string]AuthorizationMethod{ + "delete": AuthorizationMethodDELETE, + "get": AuthorizationMethodGET, + "head": AuthorizationMethodHEAD, + "options": AuthorizationMethodOPTIONS, + "patch": AuthorizationMethodPATCH, + "post": AuthorizationMethodPOST, + "put": AuthorizationMethodPUT, + "trace": AuthorizationMethodTRACE, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AuthorizationMethod(input) + return &out, nil +} + +type BearerTokenSendingMethod string + +const ( + BearerTokenSendingMethodAuthorizationHeader BearerTokenSendingMethod = "authorizationHeader" + BearerTokenSendingMethodQuery BearerTokenSendingMethod = "query" +) + +func PossibleValuesForBearerTokenSendingMethod() []string { + return []string{ + string(BearerTokenSendingMethodAuthorizationHeader), + string(BearerTokenSendingMethodQuery), + } +} + +func (s *BearerTokenSendingMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBearerTokenSendingMethod(input string) (*BearerTokenSendingMethod, error) { + vals := map[string]BearerTokenSendingMethod{ + "authorizationheader": BearerTokenSendingMethodAuthorizationHeader, + "query": BearerTokenSendingMethodQuery, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BearerTokenSendingMethod(input) + return &out, nil +} + +type ClientAuthenticationMethod string + +const ( + ClientAuthenticationMethodBasic ClientAuthenticationMethod = "Basic" + ClientAuthenticationMethodBody ClientAuthenticationMethod = "Body" +) + +func PossibleValuesForClientAuthenticationMethod() []string { + return []string{ + string(ClientAuthenticationMethodBasic), + string(ClientAuthenticationMethodBody), + } +} + +func (s *ClientAuthenticationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseClientAuthenticationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseClientAuthenticationMethod(input string) (*ClientAuthenticationMethod, error) { + vals := map[string]ClientAuthenticationMethod{ + "basic": ClientAuthenticationMethodBasic, + "body": ClientAuthenticationMethodBody, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClientAuthenticationMethod(input) + return &out, nil +} + +type GrantType string + +const ( + GrantTypeAuthorizationCode GrantType = "authorizationCode" + GrantTypeClientCredentials GrantType = "clientCredentials" + GrantTypeImplicit GrantType = "implicit" + GrantTypeResourceOwnerPassword GrantType = "resourceOwnerPassword" +) + +func PossibleValuesForGrantType() []string { + return []string{ + string(GrantTypeAuthorizationCode), + string(GrantTypeClientCredentials), + string(GrantTypeImplicit), + string(GrantTypeResourceOwnerPassword), + } +} + +func (s *GrantType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGrantType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseGrantType(input string) (*GrantType, error) { + vals := map[string]GrantType{ + "authorizationcode": GrantTypeAuthorizationCode, + "clientcredentials": GrantTypeClientCredentials, + "implicit": GrantTypeImplicit, + "resourceownerpassword": GrantTypeResourceOwnerPassword, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GrantType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/id_authorizationserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/id_authorizationserver.go new file mode 100644 index 000000000000..e5f6624ab654 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/id_authorizationserver.go @@ -0,0 +1,140 @@ +package authorizationserver + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = AuthorizationServerId{} + +// AuthorizationServerId is a struct representing the Resource ID for a Authorization Server +type AuthorizationServerId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + AuthorizationServerName string +} + +// NewAuthorizationServerID returns a new AuthorizationServerId struct +func NewAuthorizationServerID(subscriptionId string, resourceGroupName string, serviceName string, authorizationServerName string) AuthorizationServerId { + return AuthorizationServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + AuthorizationServerName: authorizationServerName, + } +} + +// ParseAuthorizationServerID parses 'input' into a AuthorizationServerId +func ParseAuthorizationServerID(input string) (*AuthorizationServerId, error) { + parser := resourceids.NewParserFromResourceIdType(AuthorizationServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AuthorizationServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.AuthorizationServerName, ok = parsed.Parsed["authorizationServerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationServerName", *parsed) + } + + return &id, nil +} + +// ParseAuthorizationServerIDInsensitively parses 'input' case-insensitively into a AuthorizationServerId +// note: this method should only be used for API response data and not user input +func ParseAuthorizationServerIDInsensitively(input string) (*AuthorizationServerId, error) { + parser := resourceids.NewParserFromResourceIdType(AuthorizationServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AuthorizationServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.AuthorizationServerName, ok = parsed.Parsed["authorizationServerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationServerName", *parsed) + } + + return &id, nil +} + +// ValidateAuthorizationServerID checks that 'input' can be parsed as a Authorization Server ID +func ValidateAuthorizationServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAuthorizationServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Authorization Server ID +func (id AuthorizationServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/authorizationServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.AuthorizationServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Authorization Server ID +func (id AuthorizationServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticAuthorizationServers", "authorizationServers", "authorizationServers"), + resourceids.UserSpecifiedSegment("authorizationServerName", "authorizationServerValue"), + } +} + +// String returns a human-readable description of this Authorization Server ID +func (id AuthorizationServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Authorization Server Name: %q", id.AuthorizationServerName), + } + return fmt.Sprintf("Authorization Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/id_service.go new file mode 100644 index 000000000000..48f4a9da5ef4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/id_service.go @@ -0,0 +1,127 @@ +package authorizationserver + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_createorupdate.go new file mode 100644 index 000000000000..9c56c38cce1a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_createorupdate.go @@ -0,0 +1,85 @@ +package authorizationserver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationServerContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c AuthorizationServerClient) CreateOrUpdate(ctx context.Context, id AuthorizationServerId, input AuthorizationServerContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_delete.go new file mode 100644 index 000000000000..ad1674315f12 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_delete.go @@ -0,0 +1,76 @@ +package authorizationserver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c AuthorizationServerClient) Delete(ctx context.Context, id AuthorizationServerId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_get.go new file mode 100644 index 000000000000..35bc15341b9c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_get.go @@ -0,0 +1,51 @@ +package authorizationserver + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationServerContract +} + +// Get ... +func (c AuthorizationServerClient) Get(ctx context.Context, id AuthorizationServerId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_getentitytag.go new file mode 100644 index 000000000000..4eb7f0abe34f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_getentitytag.go @@ -0,0 +1,46 @@ +package authorizationserver + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c AuthorizationServerClient) GetEntityTag(ctx context.Context, id AuthorizationServerId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listbyservice.go new file mode 100644 index 000000000000..17a21580a935 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listbyservice.go @@ -0,0 +1,125 @@ +package authorizationserver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AuthorizationServerContract +} + +type ListByServiceCompleteResult struct { + Items []AuthorizationServerContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c AuthorizationServerClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/authorizationServers", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AuthorizationServerContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c AuthorizationServerClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, AuthorizationServerContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AuthorizationServerClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate AuthorizationServerContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]AuthorizationServerContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listsecrets.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listsecrets.go new file mode 100644 index 000000000000..e65f9582795e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listsecrets.go @@ -0,0 +1,52 @@ +package authorizationserver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationServerSecretsContract +} + +// ListSecrets ... +func (c AuthorizationServerClient) ListSecrets(ctx context.Context, id AuthorizationServerId) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_update.go new file mode 100644 index 000000000000..d92ea160b6f3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/method_update.go @@ -0,0 +1,84 @@ +package authorizationserver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationServerContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c AuthorizationServerClient) Update(ctx context.Context, id AuthorizationServerId, input AuthorizationServerUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationservercontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationservercontract.go new file mode 100644 index 000000000000..fe29efdfe90c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationservercontract.go @@ -0,0 +1,11 @@ +package authorizationserver + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationServerContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AuthorizationServerContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationservercontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationservercontractproperties.go new file mode 100644 index 000000000000..f800160d9cd7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationservercontractproperties.go @@ -0,0 +1,23 @@ +package authorizationserver + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationServerContractProperties struct { + AuthorizationEndpoint string `json:"authorizationEndpoint"` + AuthorizationMethods *[]AuthorizationMethod `json:"authorizationMethods,omitempty"` + BearerTokenSendingMethods *[]BearerTokenSendingMethod `json:"bearerTokenSendingMethods,omitempty"` + ClientAuthenticationMethod *[]ClientAuthenticationMethod `json:"clientAuthenticationMethod,omitempty"` + ClientId string `json:"clientId"` + ClientRegistrationEndpoint string `json:"clientRegistrationEndpoint"` + ClientSecret *string `json:"clientSecret,omitempty"` + DefaultScope *string `json:"defaultScope,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName string `json:"displayName"` + GrantTypes []GrantType `json:"grantTypes"` + ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` + ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` + SupportState *bool `json:"supportState,omitempty"` + TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` + TokenEndpoint *string `json:"tokenEndpoint,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationserversecretscontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationserversecretscontract.go new file mode 100644 index 000000000000..5dadcb0def4a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationserversecretscontract.go @@ -0,0 +1,10 @@ +package authorizationserver + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationServerSecretsContract struct { + ClientSecret *string `json:"clientSecret,omitempty"` + ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` + ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationserverupdatecontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationserverupdatecontract.go new file mode 100644 index 000000000000..595ea238e788 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationserverupdatecontract.go @@ -0,0 +1,11 @@ +package authorizationserver + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationServerUpdateContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AuthorizationServerUpdateContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationserverupdatecontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationserverupdatecontractproperties.go new file mode 100644 index 000000000000..ff633dad3e96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_authorizationserverupdatecontractproperties.go @@ -0,0 +1,23 @@ +package authorizationserver + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationServerUpdateContractProperties struct { + AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` + AuthorizationMethods *[]AuthorizationMethod `json:"authorizationMethods,omitempty"` + BearerTokenSendingMethods *[]BearerTokenSendingMethod `json:"bearerTokenSendingMethods,omitempty"` + ClientAuthenticationMethod *[]ClientAuthenticationMethod `json:"clientAuthenticationMethod,omitempty"` + ClientId *string `json:"clientId,omitempty"` + ClientRegistrationEndpoint *string `json:"clientRegistrationEndpoint,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` + DefaultScope *string `json:"defaultScope,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + GrantTypes *[]GrantType `json:"grantTypes,omitempty"` + ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` + ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` + SupportState *bool `json:"supportState,omitempty"` + TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` + TokenEndpoint *string `json:"tokenEndpoint,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_tokenbodyparametercontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_tokenbodyparametercontract.go new file mode 100644 index 000000000000..63d853bc49fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/model_tokenbodyparametercontract.go @@ -0,0 +1,9 @@ +package authorizationserver + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TokenBodyParameterContract struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/predicates.go new file mode 100644 index 000000000000..a1ec772dca9d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/predicates.go @@ -0,0 +1,27 @@ +package authorizationserver + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationServerContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p AuthorizationServerContractOperationPredicate) Matches(input AuthorizationServerContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/version.go new file mode 100644 index 000000000000..003ea7da19b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver/version.go @@ -0,0 +1,12 @@ +package authorizationserver + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/authorizationserver/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/README.md new file mode 100644 index 000000000000..55270fdfedfc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend` Documentation + +The `backend` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend" +``` + + +### Client Initialization + +```go +client := backend.NewBackendClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `BackendClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := backend.NewBackendID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "backendIdValue") + +payload := backend.BackendContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, backend.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackendClient.Delete` + +```go +ctx := context.TODO() +id := backend.NewBackendID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "backendIdValue") + +read, err := client.Delete(ctx, id, backend.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackendClient.Get` + +```go +ctx := context.TODO() +id := backend.NewBackendID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "backendIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackendClient.GetEntityTag` + +```go +ctx := context.TODO() +id := backend.NewBackendID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "backendIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackendClient.ListByService` + +```go +ctx := context.TODO() +id := backend.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, backend.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, backend.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BackendClient.Update` + +```go +ctx := context.TODO() +id := backend.NewBackendID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "backendIdValue") + +payload := backend.BackendUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload, backend.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/client.go new file mode 100644 index 000000000000..8cf9c601f150 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/client.go @@ -0,0 +1,26 @@ +package backend + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendClient struct { + Client *resourcemanager.Client +} + +func NewBackendClientWithBaseURI(sdkApi sdkEnv.Api) (*BackendClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "backend", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating BackendClient: %+v", err) + } + + return &BackendClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/constants.go new file mode 100644 index 000000000000..fe71e64cb91f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/constants.go @@ -0,0 +1,51 @@ +package backend + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendProtocol string + +const ( + BackendProtocolHTTP BackendProtocol = "http" + BackendProtocolSoap BackendProtocol = "soap" +) + +func PossibleValuesForBackendProtocol() []string { + return []string{ + string(BackendProtocolHTTP), + string(BackendProtocolSoap), + } +} + +func (s *BackendProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBackendProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBackendProtocol(input string) (*BackendProtocol, error) { + vals := map[string]BackendProtocol{ + "http": BackendProtocolHTTP, + "soap": BackendProtocolSoap, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BackendProtocol(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/id_backend.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/id_backend.go new file mode 100644 index 000000000000..c7b8374637c5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/id_backend.go @@ -0,0 +1,140 @@ +package backend + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = BackendId{} + +// BackendId is a struct representing the Resource ID for a Backend +type BackendId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + BackendId string +} + +// NewBackendID returns a new BackendId struct +func NewBackendID(subscriptionId string, resourceGroupName string, serviceName string, backendId string) BackendId { + return BackendId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + BackendId: backendId, + } +} + +// ParseBackendID parses 'input' into a BackendId +func ParseBackendID(input string) (*BackendId, error) { + parser := resourceids.NewParserFromResourceIdType(BackendId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BackendId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.BackendId, ok = parsed.Parsed["backendId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendId", *parsed) + } + + return &id, nil +} + +// ParseBackendIDInsensitively parses 'input' case-insensitively into a BackendId +// note: this method should only be used for API response data and not user input +func ParseBackendIDInsensitively(input string) (*BackendId, error) { + parser := resourceids.NewParserFromResourceIdType(BackendId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BackendId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.BackendId, ok = parsed.Parsed["backendId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendId", *parsed) + } + + return &id, nil +} + +// ValidateBackendID checks that 'input' can be parsed as a Backend ID +func ValidateBackendID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseBackendID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Backend ID +func (id BackendId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/backends/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.BackendId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Backend ID +func (id BackendId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticBackends", "backends", "backends"), + resourceids.UserSpecifiedSegment("backendId", "backendIdValue"), + } +} + +// String returns a human-readable description of this Backend ID +func (id BackendId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Backend: %q", id.BackendId), + } + return fmt.Sprintf("Backend (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/id_service.go new file mode 100644 index 000000000000..a11de0ac7ea6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/id_service.go @@ -0,0 +1,127 @@ +package backend + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_createorupdate.go new file mode 100644 index 000000000000..c999d10c1869 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_createorupdate.go @@ -0,0 +1,85 @@ +package backend + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BackendContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c BackendClient) CreateOrUpdate(ctx context.Context, id BackendId, input BackendContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_delete.go new file mode 100644 index 000000000000..a8e6a5ab37b0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_delete.go @@ -0,0 +1,76 @@ +package backend + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c BackendClient) Delete(ctx context.Context, id BackendId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_get.go new file mode 100644 index 000000000000..2af01eaec6f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_get.go @@ -0,0 +1,51 @@ +package backend + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BackendContract +} + +// Get ... +func (c BackendClient) Get(ctx context.Context, id BackendId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_getentitytag.go new file mode 100644 index 000000000000..6bff18fa57dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_getentitytag.go @@ -0,0 +1,46 @@ +package backend + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c BackendClient) GetEntityTag(ctx context.Context, id BackendId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_listbyservice.go new file mode 100644 index 000000000000..1c0cb8aab20f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_listbyservice.go @@ -0,0 +1,125 @@ +package backend + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]BackendContract +} + +type ListByServiceCompleteResult struct { + Items []BackendContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c BackendClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/backends", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]BackendContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c BackendClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, BackendContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c BackendClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate BackendContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]BackendContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_update.go new file mode 100644 index 000000000000..16ad3a5f0f9f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/method_update.go @@ -0,0 +1,84 @@ +package backend + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BackendContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c BackendClient) Update(ctx context.Context, id BackendId, input BackendUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendauthorizationheadercredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendauthorizationheadercredentials.go new file mode 100644 index 000000000000..dc87cc38a54b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendauthorizationheadercredentials.go @@ -0,0 +1,9 @@ +package backend + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendAuthorizationHeaderCredentials struct { + Parameter string `json:"parameter"` + Scheme string `json:"scheme"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendcontract.go new file mode 100644 index 000000000000..b9b961e39e5e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendcontract.go @@ -0,0 +1,11 @@ +package backend + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BackendContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendcontractproperties.go new file mode 100644 index 000000000000..60018064dc36 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendcontractproperties.go @@ -0,0 +1,16 @@ +package backend + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendContractProperties struct { + Credentials *BackendCredentialsContract `json:"credentials,omitempty"` + Description *string `json:"description,omitempty"` + Properties *BackendProperties `json:"properties,omitempty"` + Protocol BackendProtocol `json:"protocol"` + Proxy *BackendProxyContract `json:"proxy,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` + Title *string `json:"title,omitempty"` + Tls *BackendTlsProperties `json:"tls,omitempty"` + Url string `json:"url"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendcredentialscontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendcredentialscontract.go new file mode 100644 index 000000000000..6e825adfed98 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendcredentialscontract.go @@ -0,0 +1,12 @@ +package backend + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendCredentialsContract struct { + Authorization *BackendAuthorizationHeaderCredentials `json:"authorization,omitempty"` + Certificate *[]string `json:"certificate,omitempty"` + CertificateIds *[]string `json:"certificateIds,omitempty"` + Header *map[string][]string `json:"header,omitempty"` + Query *map[string][]string `json:"query,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendproperties.go new file mode 100644 index 000000000000..5ac79552244d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendproperties.go @@ -0,0 +1,8 @@ +package backend + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendProperties struct { + ServiceFabricCluster *BackendServiceFabricClusterProperties `json:"serviceFabricCluster,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendproxycontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendproxycontract.go new file mode 100644 index 000000000000..7ba3d6bc9582 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendproxycontract.go @@ -0,0 +1,10 @@ +package backend + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendProxyContract struct { + Password *string `json:"password,omitempty"` + Url string `json:"url"` + Username *string `json:"username,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendservicefabricclusterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendservicefabricclusterproperties.go new file mode 100644 index 000000000000..bc5eaf1b84cf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendservicefabricclusterproperties.go @@ -0,0 +1,13 @@ +package backend + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendServiceFabricClusterProperties struct { + ClientCertificateId *string `json:"clientCertificateId,omitempty"` + ClientCertificatethumbprint *string `json:"clientCertificatethumbprint,omitempty"` + ManagementEndpoints []string `json:"managementEndpoints"` + MaxPartitionResolutionRetries *int64 `json:"maxPartitionResolutionRetries,omitempty"` + ServerCertificateThumbprints *[]string `json:"serverCertificateThumbprints,omitempty"` + ServerX509Names *[]X509CertificateName `json:"serverX509Names,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendtlsproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendtlsproperties.go new file mode 100644 index 000000000000..740fde713b47 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendtlsproperties.go @@ -0,0 +1,9 @@ +package backend + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendTlsProperties struct { + ValidateCertificateChain *bool `json:"validateCertificateChain,omitempty"` + ValidateCertificateName *bool `json:"validateCertificateName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendupdateparameterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendupdateparameterproperties.go new file mode 100644 index 000000000000..c2a45fb91601 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendupdateparameterproperties.go @@ -0,0 +1,16 @@ +package backend + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendUpdateParameterProperties struct { + Credentials *BackendCredentialsContract `json:"credentials,omitempty"` + Description *string `json:"description,omitempty"` + Properties *BackendProperties `json:"properties,omitempty"` + Protocol *BackendProtocol `json:"protocol,omitempty"` + Proxy *BackendProxyContract `json:"proxy,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` + Title *string `json:"title,omitempty"` + Tls *BackendTlsProperties `json:"tls,omitempty"` + Url *string `json:"url,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendupdateparameters.go new file mode 100644 index 000000000000..dfaa01193d2f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_backendupdateparameters.go @@ -0,0 +1,8 @@ +package backend + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendUpdateParameters struct { + Properties *BackendUpdateParameterProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_x509certificatename.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_x509certificatename.go new file mode 100644 index 000000000000..12faade510c4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/model_x509certificatename.go @@ -0,0 +1,9 @@ +package backend + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X509CertificateName struct { + IssuerCertificateThumbprint *string `json:"issuerCertificateThumbprint,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/predicates.go new file mode 100644 index 000000000000..42bc6a1a63fc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/predicates.go @@ -0,0 +1,27 @@ +package backend + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p BackendContractOperationPredicate) Matches(input BackendContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/version.go new file mode 100644 index 000000000000..d7b879a1b0bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend/version.go @@ -0,0 +1,12 @@ +package backend + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/backend/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/README.md new file mode 100644 index 000000000000..e43468d4e262 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache` Documentation + +The `cache` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache" +``` + + +### Client Initialization + +```go +client := cache.NewCacheClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CacheClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := cache.NewCacheID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "cacheIdValue") + +payload := cache.CacheContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, cache.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CacheClient.Delete` + +```go +ctx := context.TODO() +id := cache.NewCacheID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "cacheIdValue") + +read, err := client.Delete(ctx, id, cache.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CacheClient.Get` + +```go +ctx := context.TODO() +id := cache.NewCacheID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "cacheIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CacheClient.GetEntityTag` + +```go +ctx := context.TODO() +id := cache.NewCacheID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "cacheIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CacheClient.ListByService` + +```go +ctx := context.TODO() +id := cache.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, cache.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, cache.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CacheClient.Update` + +```go +ctx := context.TODO() +id := cache.NewCacheID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "cacheIdValue") + +payload := cache.CacheUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload, cache.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/client.go new file mode 100644 index 000000000000..e0befe22fa37 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/client.go @@ -0,0 +1,26 @@ +package cache + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CacheClient struct { + Client *resourcemanager.Client +} + +func NewCacheClientWithBaseURI(sdkApi sdkEnv.Api) (*CacheClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "cache", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CacheClient: %+v", err) + } + + return &CacheClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/id_cache.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/id_cache.go new file mode 100644 index 000000000000..f481a454c49f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/id_cache.go @@ -0,0 +1,140 @@ +package cache + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = CacheId{} + +// CacheId is a struct representing the Resource ID for a Cache +type CacheId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + CacheId string +} + +// NewCacheID returns a new CacheId struct +func NewCacheID(subscriptionId string, resourceGroupName string, serviceName string, cacheId string) CacheId { + return CacheId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + CacheId: cacheId, + } +} + +// ParseCacheID parses 'input' into a CacheId +func ParseCacheID(input string) (*CacheId, error) { + parser := resourceids.NewParserFromResourceIdType(CacheId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CacheId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.CacheId, ok = parsed.Parsed["cacheId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheId", *parsed) + } + + return &id, nil +} + +// ParseCacheIDInsensitively parses 'input' case-insensitively into a CacheId +// note: this method should only be used for API response data and not user input +func ParseCacheIDInsensitively(input string) (*CacheId, error) { + parser := resourceids.NewParserFromResourceIdType(CacheId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CacheId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.CacheId, ok = parsed.Parsed["cacheId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheId", *parsed) + } + + return &id, nil +} + +// ValidateCacheID checks that 'input' can be parsed as a Cache ID +func ValidateCacheID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCacheID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cache ID +func (id CacheId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/caches/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.CacheId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cache ID +func (id CacheId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticCaches", "caches", "caches"), + resourceids.UserSpecifiedSegment("cacheId", "cacheIdValue"), + } +} + +// String returns a human-readable description of this Cache ID +func (id CacheId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Cache: %q", id.CacheId), + } + return fmt.Sprintf("Cache (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/id_service.go new file mode 100644 index 000000000000..bbca8da8f3a7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/id_service.go @@ -0,0 +1,127 @@ +package cache + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_createorupdate.go new file mode 100644 index 000000000000..ae370ba6bb96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_createorupdate.go @@ -0,0 +1,85 @@ +package cache + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CacheContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c CacheClient) CreateOrUpdate(ctx context.Context, id CacheId, input CacheContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_delete.go new file mode 100644 index 000000000000..4409902bb763 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_delete.go @@ -0,0 +1,76 @@ +package cache + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c CacheClient) Delete(ctx context.Context, id CacheId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_get.go new file mode 100644 index 000000000000..8108214f7810 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_get.go @@ -0,0 +1,51 @@ +package cache + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CacheContract +} + +// Get ... +func (c CacheClient) Get(ctx context.Context, id CacheId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_getentitytag.go new file mode 100644 index 000000000000..a221bde18d1e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_getentitytag.go @@ -0,0 +1,46 @@ +package cache + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c CacheClient) GetEntityTag(ctx context.Context, id CacheId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_listbyservice.go new file mode 100644 index 000000000000..748d4374751c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_listbyservice.go @@ -0,0 +1,121 @@ +package cache + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CacheContract +} + +type ListByServiceCompleteResult struct { + Items []CacheContract +} + +type ListByServiceOperationOptions struct { + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c CacheClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/caches", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]CacheContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c CacheClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, CacheContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CacheClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate CacheContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]CacheContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_update.go new file mode 100644 index 000000000000..3aca9c35b369 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/method_update.go @@ -0,0 +1,84 @@ +package cache + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CacheContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c CacheClient) Update(ctx context.Context, id CacheId, input CacheUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cachecontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cachecontract.go new file mode 100644 index 000000000000..6ce21934bcd4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cachecontract.go @@ -0,0 +1,11 @@ +package cache + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CacheContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *CacheContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cachecontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cachecontractproperties.go new file mode 100644 index 000000000000..930e9155fabf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cachecontractproperties.go @@ -0,0 +1,11 @@ +package cache + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CacheContractProperties struct { + ConnectionString string `json:"connectionString"` + Description *string `json:"description,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` + UseFromLocation string `json:"useFromLocation"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cacheupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cacheupdateparameters.go new file mode 100644 index 000000000000..6519a6e4c7e8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cacheupdateparameters.go @@ -0,0 +1,8 @@ +package cache + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CacheUpdateParameters struct { + Properties *CacheUpdateProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cacheupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cacheupdateproperties.go new file mode 100644 index 000000000000..3e8292d3f833 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/model_cacheupdateproperties.go @@ -0,0 +1,11 @@ +package cache + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CacheUpdateProperties struct { + ConnectionString *string `json:"connectionString,omitempty"` + Description *string `json:"description,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` + UseFromLocation *string `json:"useFromLocation,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/predicates.go new file mode 100644 index 000000000000..e1d595e6530a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/predicates.go @@ -0,0 +1,27 @@ +package cache + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CacheContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p CacheContractOperationPredicate) Matches(input CacheContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/version.go new file mode 100644 index 000000000000..5f1966142622 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache/version.go @@ -0,0 +1,12 @@ +package cache + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/cache/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/README.md new file mode 100644 index 000000000000..8874a3adcf70 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/README.md @@ -0,0 +1,122 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate` Documentation + +The `certificate` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate" +``` + + +### Client Initialization + +```go +client := certificate.NewCertificateClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CertificateClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := certificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "certificateIdValue") + +payload := certificate.CertificateCreateOrUpdateParameters{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, certificate.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CertificateClient.Delete` + +```go +ctx := context.TODO() +id := certificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "certificateIdValue") + +read, err := client.Delete(ctx, id, certificate.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CertificateClient.Get` + +```go +ctx := context.TODO() +id := certificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "certificateIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CertificateClient.GetEntityTag` + +```go +ctx := context.TODO() +id := certificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "certificateIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CertificateClient.ListByService` + +```go +ctx := context.TODO() +id := certificate.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, certificate.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, certificate.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CertificateClient.RefreshSecret` + +```go +ctx := context.TODO() +id := certificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "certificateIdValue") + +read, err := client.RefreshSecret(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/client.go new file mode 100644 index 000000000000..9c7a68853627 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/client.go @@ -0,0 +1,26 @@ +package certificate + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateClient struct { + Client *resourcemanager.Client +} + +func NewCertificateClientWithBaseURI(sdkApi sdkEnv.Api) (*CertificateClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "certificate", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CertificateClient: %+v", err) + } + + return &CertificateClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/id_certificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/id_certificate.go new file mode 100644 index 000000000000..623d4954eced --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/id_certificate.go @@ -0,0 +1,140 @@ +package certificate + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = CertificateId{} + +// CertificateId is a struct representing the Resource ID for a Certificate +type CertificateId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + CertificateId string +} + +// NewCertificateID returns a new CertificateId struct +func NewCertificateID(subscriptionId string, resourceGroupName string, serviceName string, certificateId string) CertificateId { + return CertificateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + CertificateId: certificateId, + } +} + +// ParseCertificateID parses 'input' into a CertificateId +func ParseCertificateID(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(CertificateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CertificateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + } + + return &id, nil +} + +// ParseCertificateIDInsensitively parses 'input' case-insensitively into a CertificateId +// note: this method should only be used for API response data and not user input +func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(CertificateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CertificateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + } + + return &id, nil +} + +// ValidateCertificateID checks that 'input' can be parsed as a Certificate ID +func ValidateCertificateID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCertificateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Certificate ID +func (id CertificateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/certificates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.CertificateId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Certificate ID +func (id CertificateId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticCertificates", "certificates", "certificates"), + resourceids.UserSpecifiedSegment("certificateId", "certificateIdValue"), + } +} + +// String returns a human-readable description of this Certificate ID +func (id CertificateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Certificate: %q", id.CertificateId), + } + return fmt.Sprintf("Certificate (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/id_service.go new file mode 100644 index 000000000000..66a90053cb1b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/id_service.go @@ -0,0 +1,127 @@ +package certificate + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_createorupdate.go new file mode 100644 index 000000000000..93fbccd7109a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_createorupdate.go @@ -0,0 +1,85 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CertificateContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c CertificateClient) CreateOrUpdate(ctx context.Context, id CertificateId, input CertificateCreateOrUpdateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_delete.go new file mode 100644 index 000000000000..18be0e732de5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_delete.go @@ -0,0 +1,76 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c CertificateClient) Delete(ctx context.Context, id CertificateId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_get.go new file mode 100644 index 000000000000..27e5fbafdfab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_get.go @@ -0,0 +1,51 @@ +package certificate + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CertificateContract +} + +// Get ... +func (c CertificateClient) Get(ctx context.Context, id CertificateId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_getentitytag.go new file mode 100644 index 000000000000..bcbd65b8f9b9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_getentitytag.go @@ -0,0 +1,46 @@ +package certificate + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c CertificateClient) GetEntityTag(ctx context.Context, id CertificateId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_listbyservice.go new file mode 100644 index 000000000000..cf5649185fc5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_listbyservice.go @@ -0,0 +1,129 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CertificateContract +} + +type ListByServiceCompleteResult struct { + Items []CertificateContract +} + +type ListByServiceOperationOptions struct { + Filter *string + IsKeyVaultRefreshFailed *bool + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.IsKeyVaultRefreshFailed != nil { + out.Append("isKeyVaultRefreshFailed", fmt.Sprintf("%v", *o.IsKeyVaultRefreshFailed)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c CertificateClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/certificates", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]CertificateContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c CertificateClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, CertificateContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CertificateClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate CertificateContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]CertificateContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_refreshsecret.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_refreshsecret.go new file mode 100644 index 000000000000..8c7aaf791626 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/method_refreshsecret.go @@ -0,0 +1,52 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RefreshSecretOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CertificateContract +} + +// RefreshSecret ... +func (c CertificateClient) RefreshSecret(ctx context.Context, id CertificateId) (result RefreshSecretOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/refreshSecret", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecontract.go new file mode 100644 index 000000000000..15a790b5e4b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecontract.go @@ -0,0 +1,11 @@ +package certificate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *CertificateContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecontractproperties.go new file mode 100644 index 000000000000..6ef4ff5eb2b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecontractproperties.go @@ -0,0 +1,26 @@ +package certificate + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateContractProperties struct { + ExpirationDate string `json:"expirationDate"` + KeyVault *KeyVaultContractProperties `json:"keyVault,omitempty"` + Subject string `json:"subject"` + Thumbprint string `json:"thumbprint"` +} + +func (o *CertificateContractProperties) GetExpirationDateAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.ExpirationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *CertificateContractProperties) SetExpirationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationDate = formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecreateorupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecreateorupdateparameters.go new file mode 100644 index 000000000000..8e5582519ad6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecreateorupdateparameters.go @@ -0,0 +1,8 @@ +package certificate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateCreateOrUpdateParameters struct { + Properties *CertificateCreateOrUpdateProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecreateorupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecreateorupdateproperties.go new file mode 100644 index 000000000000..8253b21efb08 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_certificatecreateorupdateproperties.go @@ -0,0 +1,10 @@ +package certificate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateCreateOrUpdateProperties struct { + Data *string `json:"data,omitempty"` + KeyVault *KeyVaultContractCreateProperties `json:"keyVault,omitempty"` + Password *string `json:"password,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_keyvaultcontractcreateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_keyvaultcontractcreateproperties.go new file mode 100644 index 000000000000..a279a78f88b8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_keyvaultcontractcreateproperties.go @@ -0,0 +1,9 @@ +package certificate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultContractCreateProperties struct { + IdentityClientId *string `json:"identityClientId,omitempty"` + SecretIdentifier *string `json:"secretIdentifier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_keyvaultcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_keyvaultcontractproperties.go new file mode 100644 index 000000000000..50a575bd3445 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_keyvaultcontractproperties.go @@ -0,0 +1,10 @@ +package certificate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultContractProperties struct { + IdentityClientId *string `json:"identityClientId,omitempty"` + LastStatus *KeyVaultLastAccessStatusContractProperties `json:"lastStatus,omitempty"` + SecretIdentifier *string `json:"secretIdentifier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_keyvaultlastaccessstatuscontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_keyvaultlastaccessstatuscontractproperties.go new file mode 100644 index 000000000000..9596c23b8f69 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/model_keyvaultlastaccessstatuscontractproperties.go @@ -0,0 +1,28 @@ +package certificate + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultLastAccessStatusContractProperties struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + TimeStampUtc *string `json:"timeStampUtc,omitempty"` +} + +func (o *KeyVaultLastAccessStatusContractProperties) GetTimeStampUtcAsTime() (*time.Time, error) { + if o.TimeStampUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeStampUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *KeyVaultLastAccessStatusContractProperties) SetTimeStampUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeStampUtc = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/predicates.go new file mode 100644 index 000000000000..62350ffb8a74 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/predicates.go @@ -0,0 +1,27 @@ +package certificate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p CertificateContractOperationPredicate) Matches(input CertificateContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/version.go new file mode 100644 index 000000000000..7c164a7e8545 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate/version.go @@ -0,0 +1,12 @@ +package certificate + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/certificate/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/README.md new file mode 100644 index 000000000000..95bfcfa7f029 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/README.md @@ -0,0 +1,110 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings` Documentation + +The `delegationsettings` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings" +``` + + +### Client Initialization + +```go +client := delegationsettings.NewDelegationSettingsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DelegationSettingsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := delegationsettings.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +payload := delegationsettings.PortalDelegationSettings{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, delegationsettings.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DelegationSettingsClient.Get` + +```go +ctx := context.TODO() +id := delegationsettings.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DelegationSettingsClient.GetEntityTag` + +```go +ctx := context.TODO() +id := delegationsettings.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DelegationSettingsClient.ListSecrets` + +```go +ctx := context.TODO() +id := delegationsettings.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +read, err := client.ListSecrets(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DelegationSettingsClient.Update` + +```go +ctx := context.TODO() +id := delegationsettings.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +payload := delegationsettings.PortalDelegationSettings{ + // ... +} + + +read, err := client.Update(ctx, id, payload, delegationsettings.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/client.go new file mode 100644 index 000000000000..975a55a7a100 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/client.go @@ -0,0 +1,26 @@ +package delegationsettings + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DelegationSettingsClient struct { + Client *resourcemanager.Client +} + +func NewDelegationSettingsClientWithBaseURI(sdkApi sdkEnv.Api) (*DelegationSettingsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "delegationsettings", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DelegationSettingsClient: %+v", err) + } + + return &DelegationSettingsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/id_service.go new file mode 100644 index 000000000000..c58ec8e039b0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/id_service.go @@ -0,0 +1,127 @@ +package delegationsettings + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_createorupdate.go new file mode 100644 index 000000000000..798382faf25d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_createorupdate.go @@ -0,0 +1,84 @@ +package delegationsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalDelegationSettings +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c DelegationSettingsClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PortalDelegationSettings, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/portalsettings/delegation", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_get.go new file mode 100644 index 000000000000..7e0f9378ef18 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_get.go @@ -0,0 +1,52 @@ +package delegationsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalDelegationSettings +} + +// Get ... +func (c DelegationSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/portalsettings/delegation", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_getentitytag.go new file mode 100644 index 000000000000..6d1fc5745c7f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_getentitytag.go @@ -0,0 +1,47 @@ +package delegationsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c DelegationSettingsClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/portalsettings/delegation", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_listsecrets.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_listsecrets.go new file mode 100644 index 000000000000..baf7a240e3b2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_listsecrets.go @@ -0,0 +1,52 @@ +package delegationsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSettingValidationKeyContract +} + +// ListSecrets ... +func (c DelegationSettingsClient) ListSecrets(ctx context.Context, id ServiceId) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/portalsettings/delegation/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_update.go new file mode 100644 index 000000000000..924b296b5fad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/method_update.go @@ -0,0 +1,79 @@ +package delegationsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c DelegationSettingsClient) Update(ctx context.Context, id ServiceId, input PortalDelegationSettings, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/portalsettings/delegation", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_portaldelegationsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_portaldelegationsettings.go new file mode 100644 index 000000000000..5ae7e1afcf15 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_portaldelegationsettings.go @@ -0,0 +1,11 @@ +package delegationsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PortalDelegationSettings struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PortalDelegationSettingsProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_portaldelegationsettingsproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_portaldelegationsettingsproperties.go new file mode 100644 index 000000000000..e15507944d5a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_portaldelegationsettingsproperties.go @@ -0,0 +1,11 @@ +package delegationsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PortalDelegationSettingsProperties struct { + Subscriptions *SubscriptionsDelegationSettingsProperties `json:"subscriptions,omitempty"` + Url *string `json:"url,omitempty"` + UserRegistration *RegistrationDelegationSettingsProperties `json:"userRegistration,omitempty"` + ValidationKey *string `json:"validationKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_portalsettingvalidationkeycontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_portalsettingvalidationkeycontract.go new file mode 100644 index 000000000000..a9c04e71e689 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_portalsettingvalidationkeycontract.go @@ -0,0 +1,8 @@ +package delegationsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PortalSettingValidationKeyContract struct { + ValidationKey *string `json:"validationKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_registrationdelegationsettingsproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_registrationdelegationsettingsproperties.go new file mode 100644 index 000000000000..6b440ac2f190 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_registrationdelegationsettingsproperties.go @@ -0,0 +1,8 @@ +package delegationsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegistrationDelegationSettingsProperties struct { + Enabled *bool `json:"enabled,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_subscriptionsdelegationsettingsproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_subscriptionsdelegationsettingsproperties.go new file mode 100644 index 000000000000..4d1c8e581a74 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/model_subscriptionsdelegationsettingsproperties.go @@ -0,0 +1,8 @@ +package delegationsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionsDelegationSettingsProperties struct { + Enabled *bool `json:"enabled,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/version.go new file mode 100644 index 000000000000..2d248c51e67f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings/version.go @@ -0,0 +1,12 @@ +package delegationsettings + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/delegationsettings/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/README.md new file mode 100644 index 000000000000..6e85373ffd98 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/README.md @@ -0,0 +1,65 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice` Documentation + +The `deletedservice` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice" +``` + + +### Client Initialization + +```go +client := deletedservice.NewDeletedServiceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DeletedServiceClient.GetByName` + +```go +ctx := context.TODO() +id := deletedservice.NewDeletedServiceID("12345678-1234-9876-4563-123456789012", "locationValue", "deletedServiceValue") + +read, err := client.GetByName(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DeletedServiceClient.ListBySubscription` + +```go +ctx := context.TODO() +id := deletedservice.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DeletedServiceClient.Purge` + +```go +ctx := context.TODO() +id := deletedservice.NewDeletedServiceID("12345678-1234-9876-4563-123456789012", "locationValue", "deletedServiceValue") + +if err := client.PurgeThenPoll(ctx, id); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/client.go new file mode 100644 index 000000000000..7ce116a72599 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/client.go @@ -0,0 +1,26 @@ +package deletedservice + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeletedServiceClient struct { + Client *resourcemanager.Client +} + +func NewDeletedServiceClientWithBaseURI(sdkApi sdkEnv.Api) (*DeletedServiceClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "deletedservice", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DeletedServiceClient: %+v", err) + } + + return &DeletedServiceClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/id_deletedservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/id_deletedservice.go new file mode 100644 index 000000000000..16ae59293af1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/id_deletedservice.go @@ -0,0 +1,127 @@ +package deletedservice + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = DeletedServiceId{} + +// DeletedServiceId is a struct representing the Resource ID for a Deleted Service +type DeletedServiceId struct { + SubscriptionId string + LocationName string + DeletedServiceName string +} + +// NewDeletedServiceID returns a new DeletedServiceId struct +func NewDeletedServiceID(subscriptionId string, locationName string, deletedServiceName string) DeletedServiceId { + return DeletedServiceId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + DeletedServiceName: deletedServiceName, + } +} + +// ParseDeletedServiceID parses 'input' into a DeletedServiceId +func ParseDeletedServiceID(input string) (*DeletedServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(DeletedServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DeletedServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + } + + if id.DeletedServiceName, ok = parsed.Parsed["deletedServiceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedServiceName", *parsed) + } + + return &id, nil +} + +// ParseDeletedServiceIDInsensitively parses 'input' case-insensitively into a DeletedServiceId +// note: this method should only be used for API response data and not user input +func ParseDeletedServiceIDInsensitively(input string) (*DeletedServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(DeletedServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DeletedServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + } + + if id.DeletedServiceName, ok = parsed.Parsed["deletedServiceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedServiceName", *parsed) + } + + return &id, nil +} + +// ValidateDeletedServiceID checks that 'input' can be parsed as a Deleted Service ID +func ValidateDeletedServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDeletedServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Deleted Service ID +func (id DeletedServiceId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.ApiManagement/locations/%s/deletedServices/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.DeletedServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Deleted Service ID +func (id DeletedServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), + resourceids.StaticSegment("staticDeletedServices", "deletedServices", "deletedServices"), + resourceids.UserSpecifiedSegment("deletedServiceName", "deletedServiceValue"), + } +} + +// String returns a human-readable description of this Deleted Service ID +func (id DeletedServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Deleted Service Name: %q", id.DeletedServiceName), + } + return fmt.Sprintf("Deleted Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/method_getbyname.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/method_getbyname.go new file mode 100644 index 000000000000..f6404fd9b483 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/method_getbyname.go @@ -0,0 +1,51 @@ +package deletedservice + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetByNameOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DeletedServiceContract +} + +// GetByName ... +func (c DeletedServiceClient) GetByName(ctx context.Context, id DeletedServiceId) (result GetByNameOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/method_listbysubscription.go new file mode 100644 index 000000000000..f6077a9e1f15 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/method_listbysubscription.go @@ -0,0 +1,90 @@ +package deletedservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DeletedServiceContract +} + +type ListBySubscriptionCompleteResult struct { + Items []DeletedServiceContract +} + +// ListBySubscription ... +func (c DeletedServiceClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/deletedServices", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DeletedServiceContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c DeletedServiceClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, DeletedServiceContractOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DeletedServiceClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DeletedServiceContractOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]DeletedServiceContract, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/method_purge.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/method_purge.go new file mode 100644 index 000000000000..0e5dcf28a3d7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/method_purge.go @@ -0,0 +1,71 @@ +package deletedservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PurgeOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Purge ... +func (c DeletedServiceClient) Purge(ctx context.Context, id DeletedServiceId) (result PurgeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// PurgeThenPoll performs Purge then polls until it's completed +func (c DeletedServiceClient) PurgeThenPoll(ctx context.Context, id DeletedServiceId) error { + result, err := c.Purge(ctx, id) + if err != nil { + return fmt.Errorf("performing Purge: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Purge: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/model_deletedservicecontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/model_deletedservicecontract.go new file mode 100644 index 000000000000..23d3fd90428f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/model_deletedservicecontract.go @@ -0,0 +1,12 @@ +package deletedservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeletedServiceContract struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DeletedServiceContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/model_deletedservicecontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/model_deletedservicecontractproperties.go new file mode 100644 index 000000000000..3ac7f055ea83 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/model_deletedservicecontractproperties.go @@ -0,0 +1,40 @@ +package deletedservice + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeletedServiceContractProperties struct { + DeletionDate *string `json:"deletionDate,omitempty"` + ScheduledPurgeDate *string `json:"scheduledPurgeDate,omitempty"` + ServiceId *string `json:"serviceId,omitempty"` +} + +func (o *DeletedServiceContractProperties) GetDeletionDateAsTime() (*time.Time, error) { + if o.DeletionDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.DeletionDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *DeletedServiceContractProperties) SetDeletionDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.DeletionDate = &formatted +} + +func (o *DeletedServiceContractProperties) GetScheduledPurgeDateAsTime() (*time.Time, error) { + if o.ScheduledPurgeDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ScheduledPurgeDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *DeletedServiceContractProperties) SetScheduledPurgeDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ScheduledPurgeDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/predicates.go new file mode 100644 index 000000000000..54bf3b119fbf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/predicates.go @@ -0,0 +1,32 @@ +package deletedservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeletedServiceContractOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p DeletedServiceContractOperationPredicate) Matches(input DeletedServiceContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/version.go new file mode 100644 index 000000000000..b42fd7e91b4c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice/version.go @@ -0,0 +1,12 @@ +package deletedservice + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/deletedservice/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/README.md new file mode 100644 index 000000000000..fe2f31e2dc8b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic` Documentation + +The `diagnostic` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic" +``` + + +### Client Initialization + +```go +client := diagnostic.NewDiagnosticClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DiagnosticClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := diagnostic.NewDiagnosticID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "diagnosticIdValue") + +payload := diagnostic.DiagnosticContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, diagnostic.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DiagnosticClient.Delete` + +```go +ctx := context.TODO() +id := diagnostic.NewDiagnosticID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "diagnosticIdValue") + +read, err := client.Delete(ctx, id, diagnostic.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DiagnosticClient.Get` + +```go +ctx := context.TODO() +id := diagnostic.NewDiagnosticID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "diagnosticIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DiagnosticClient.GetEntityTag` + +```go +ctx := context.TODO() +id := diagnostic.NewDiagnosticID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "diagnosticIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DiagnosticClient.ListByService` + +```go +ctx := context.TODO() +id := diagnostic.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, diagnostic.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, diagnostic.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DiagnosticClient.Update` + +```go +ctx := context.TODO() +id := diagnostic.NewDiagnosticID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "diagnosticIdValue") + +payload := diagnostic.DiagnosticContract{ + // ... +} + + +read, err := client.Update(ctx, id, payload, diagnostic.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/client.go new file mode 100644 index 000000000000..d7b4ed69319f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/client.go @@ -0,0 +1,26 @@ +package diagnostic + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticClient struct { + Client *resourcemanager.Client +} + +func NewDiagnosticClientWithBaseURI(sdkApi sdkEnv.Api) (*DiagnosticClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "diagnostic", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DiagnosticClient: %+v", err) + } + + return &DiagnosticClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/constants.go new file mode 100644 index 000000000000..cde4ab74afa3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/constants.go @@ -0,0 +1,256 @@ +package diagnostic + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AlwaysLog string + +const ( + AlwaysLogAllErrors AlwaysLog = "allErrors" +) + +func PossibleValuesForAlwaysLog() []string { + return []string{ + string(AlwaysLogAllErrors), + } +} + +func (s *AlwaysLog) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAlwaysLog(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAlwaysLog(input string) (*AlwaysLog, error) { + vals := map[string]AlwaysLog{ + "allerrors": AlwaysLogAllErrors, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AlwaysLog(input) + return &out, nil +} + +type DataMaskingMode string + +const ( + DataMaskingModeHide DataMaskingMode = "Hide" + DataMaskingModeMask DataMaskingMode = "Mask" +) + +func PossibleValuesForDataMaskingMode() []string { + return []string{ + string(DataMaskingModeHide), + string(DataMaskingModeMask), + } +} + +func (s *DataMaskingMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDataMaskingMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDataMaskingMode(input string) (*DataMaskingMode, error) { + vals := map[string]DataMaskingMode{ + "hide": DataMaskingModeHide, + "mask": DataMaskingModeMask, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DataMaskingMode(input) + return &out, nil +} + +type HTTPCorrelationProtocol string + +const ( + HTTPCorrelationProtocolLegacy HTTPCorrelationProtocol = "Legacy" + HTTPCorrelationProtocolNone HTTPCorrelationProtocol = "None" + HTTPCorrelationProtocolWThreeC HTTPCorrelationProtocol = "W3C" +) + +func PossibleValuesForHTTPCorrelationProtocol() []string { + return []string{ + string(HTTPCorrelationProtocolLegacy), + string(HTTPCorrelationProtocolNone), + string(HTTPCorrelationProtocolWThreeC), + } +} + +func (s *HTTPCorrelationProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHTTPCorrelationProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHTTPCorrelationProtocol(input string) (*HTTPCorrelationProtocol, error) { + vals := map[string]HTTPCorrelationProtocol{ + "legacy": HTTPCorrelationProtocolLegacy, + "none": HTTPCorrelationProtocolNone, + "w3c": HTTPCorrelationProtocolWThreeC, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HTTPCorrelationProtocol(input) + return &out, nil +} + +type OperationNameFormat string + +const ( + OperationNameFormatName OperationNameFormat = "Name" + OperationNameFormatUrl OperationNameFormat = "Url" +) + +func PossibleValuesForOperationNameFormat() []string { + return []string{ + string(OperationNameFormatName), + string(OperationNameFormatUrl), + } +} + +func (s *OperationNameFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperationNameFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperationNameFormat(input string) (*OperationNameFormat, error) { + vals := map[string]OperationNameFormat{ + "name": OperationNameFormatName, + "url": OperationNameFormatUrl, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperationNameFormat(input) + return &out, nil +} + +type SamplingType string + +const ( + SamplingTypeFixed SamplingType = "fixed" +) + +func PossibleValuesForSamplingType() []string { + return []string{ + string(SamplingTypeFixed), + } +} + +func (s *SamplingType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSamplingType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSamplingType(input string) (*SamplingType, error) { + vals := map[string]SamplingType{ + "fixed": SamplingTypeFixed, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SamplingType(input) + return &out, nil +} + +type Verbosity string + +const ( + VerbosityError Verbosity = "error" + VerbosityInformation Verbosity = "information" + VerbosityVerbose Verbosity = "verbose" +) + +func PossibleValuesForVerbosity() []string { + return []string{ + string(VerbosityError), + string(VerbosityInformation), + string(VerbosityVerbose), + } +} + +func (s *Verbosity) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVerbosity(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVerbosity(input string) (*Verbosity, error) { + vals := map[string]Verbosity{ + "error": VerbosityError, + "information": VerbosityInformation, + "verbose": VerbosityVerbose, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Verbosity(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/id_diagnostic.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/id_diagnostic.go new file mode 100644 index 000000000000..e283d041523d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/id_diagnostic.go @@ -0,0 +1,140 @@ +package diagnostic + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = DiagnosticId{} + +// DiagnosticId is a struct representing the Resource ID for a Diagnostic +type DiagnosticId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + DiagnosticId string +} + +// NewDiagnosticID returns a new DiagnosticId struct +func NewDiagnosticID(subscriptionId string, resourceGroupName string, serviceName string, diagnosticId string) DiagnosticId { + return DiagnosticId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + DiagnosticId: diagnosticId, + } +} + +// ParseDiagnosticID parses 'input' into a DiagnosticId +func ParseDiagnosticID(input string) (*DiagnosticId, error) { + parser := resourceids.NewParserFromResourceIdType(DiagnosticId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DiagnosticId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + } + + return &id, nil +} + +// ParseDiagnosticIDInsensitively parses 'input' case-insensitively into a DiagnosticId +// note: this method should only be used for API response data and not user input +func ParseDiagnosticIDInsensitively(input string) (*DiagnosticId, error) { + parser := resourceids.NewParserFromResourceIdType(DiagnosticId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DiagnosticId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + } + + return &id, nil +} + +// ValidateDiagnosticID checks that 'input' can be parsed as a Diagnostic ID +func ValidateDiagnosticID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDiagnosticID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Diagnostic ID +func (id DiagnosticId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/diagnostics/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.DiagnosticId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Diagnostic ID +func (id DiagnosticId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticDiagnostics", "diagnostics", "diagnostics"), + resourceids.UserSpecifiedSegment("diagnosticId", "diagnosticIdValue"), + } +} + +// String returns a human-readable description of this Diagnostic ID +func (id DiagnosticId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Diagnostic: %q", id.DiagnosticId), + } + return fmt.Sprintf("Diagnostic (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/id_service.go new file mode 100644 index 000000000000..521b0f80d0a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/id_service.go @@ -0,0 +1,127 @@ +package diagnostic + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_createorupdate.go new file mode 100644 index 000000000000..7b559f7022ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_createorupdate.go @@ -0,0 +1,85 @@ +package diagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c DiagnosticClient) CreateOrUpdate(ctx context.Context, id DiagnosticId, input DiagnosticContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_delete.go new file mode 100644 index 000000000000..3cd08df2cd9f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_delete.go @@ -0,0 +1,76 @@ +package diagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c DiagnosticClient) Delete(ctx context.Context, id DiagnosticId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_get.go new file mode 100644 index 000000000000..efc4cc740898 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_get.go @@ -0,0 +1,51 @@ +package diagnostic + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +// Get ... +func (c DiagnosticClient) Get(ctx context.Context, id DiagnosticId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_getentitytag.go new file mode 100644 index 000000000000..8be53cb6cbf7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_getentitytag.go @@ -0,0 +1,46 @@ +package diagnostic + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c DiagnosticClient) GetEntityTag(ctx context.Context, id DiagnosticId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_listbyservice.go new file mode 100644 index 000000000000..591d81877f46 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_listbyservice.go @@ -0,0 +1,125 @@ +package diagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DiagnosticContract +} + +type ListByServiceCompleteResult struct { + Items []DiagnosticContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c DiagnosticClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/diagnostics", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DiagnosticContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c DiagnosticClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, DiagnosticContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DiagnosticClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate DiagnosticContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]DiagnosticContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_update.go new file mode 100644 index 000000000000..cc36660c9e8e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/method_update.go @@ -0,0 +1,84 @@ +package diagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c DiagnosticClient) Update(ctx context.Context, id DiagnosticId, input DiagnosticContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_bodydiagnosticsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_bodydiagnosticsettings.go new file mode 100644 index 000000000000..5c1e7e811548 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_bodydiagnosticsettings.go @@ -0,0 +1,8 @@ +package diagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BodyDiagnosticSettings struct { + Bytes *int64 `json:"bytes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_datamasking.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_datamasking.go new file mode 100644 index 000000000000..2e76abd5c6bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_datamasking.go @@ -0,0 +1,9 @@ +package diagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataMasking struct { + Headers *[]DataMaskingEntity `json:"headers,omitempty"` + QueryParams *[]DataMaskingEntity `json:"queryParams,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_datamaskingentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_datamaskingentity.go new file mode 100644 index 000000000000..2b733980670d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_datamaskingentity.go @@ -0,0 +1,9 @@ +package diagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataMaskingEntity struct { + Mode *DataMaskingMode `json:"mode,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_diagnosticcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_diagnosticcontract.go new file mode 100644 index 000000000000..879a408c4cfd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_diagnosticcontract.go @@ -0,0 +1,11 @@ +package diagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DiagnosticContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_diagnosticcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_diagnosticcontractproperties.go new file mode 100644 index 000000000000..402793421a3d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_diagnosticcontractproperties.go @@ -0,0 +1,17 @@ +package diagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticContractProperties struct { + AlwaysLog *AlwaysLog `json:"alwaysLog,omitempty"` + Backend *PipelineDiagnosticSettings `json:"backend,omitempty"` + Frontend *PipelineDiagnosticSettings `json:"frontend,omitempty"` + HTTPCorrelationProtocol *HTTPCorrelationProtocol `json:"httpCorrelationProtocol,omitempty"` + LogClientIP *bool `json:"logClientIp,omitempty"` + LoggerId string `json:"loggerId"` + Metrics *bool `json:"metrics,omitempty"` + OperationNameFormat *OperationNameFormat `json:"operationNameFormat,omitempty"` + Sampling *SamplingSettings `json:"sampling,omitempty"` + Verbosity *Verbosity `json:"verbosity,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_httpmessagediagnostic.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_httpmessagediagnostic.go new file mode 100644 index 000000000000..f37eb16b51cc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_httpmessagediagnostic.go @@ -0,0 +1,10 @@ +package diagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HTTPMessageDiagnostic struct { + Body *BodyDiagnosticSettings `json:"body,omitempty"` + DataMasking *DataMasking `json:"dataMasking,omitempty"` + Headers *[]string `json:"headers,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_pipelinediagnosticsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_pipelinediagnosticsettings.go new file mode 100644 index 000000000000..329404c19996 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_pipelinediagnosticsettings.go @@ -0,0 +1,9 @@ +package diagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PipelineDiagnosticSettings struct { + Request *HTTPMessageDiagnostic `json:"request,omitempty"` + Response *HTTPMessageDiagnostic `json:"response,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_samplingsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_samplingsettings.go new file mode 100644 index 000000000000..b4efe2c80eaa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/model_samplingsettings.go @@ -0,0 +1,9 @@ +package diagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SamplingSettings struct { + Percentage *float64 `json:"percentage,omitempty"` + SamplingType *SamplingType `json:"samplingType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/predicates.go new file mode 100644 index 000000000000..1a3641637d29 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/predicates.go @@ -0,0 +1,27 @@ +package diagnostic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DiagnosticContractOperationPredicate) Matches(input DiagnosticContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/version.go new file mode 100644 index 000000000000..d202f9168f2f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic/version.go @@ -0,0 +1,12 @@ +package diagnostic + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/diagnostic/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/README.md new file mode 100644 index 000000000000..bed8065f2603 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/README.md @@ -0,0 +1,110 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates` Documentation + +The `emailtemplates` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates" +``` + + +### Client Initialization + +```go +client := emailtemplates.NewEmailTemplatesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `EmailTemplatesClient.EmailTemplateCreateOrUpdate` + +```go +ctx := context.TODO() +id := emailtemplates.NewTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "accountClosedDeveloper") + +payload := emailtemplates.EmailTemplateUpdateParameters{ + // ... +} + + +read, err := client.EmailTemplateCreateOrUpdate(ctx, id, payload, emailtemplates.DefaultEmailTemplateCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EmailTemplatesClient.EmailTemplateDelete` + +```go +ctx := context.TODO() +id := emailtemplates.NewTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "accountClosedDeveloper") + +read, err := client.EmailTemplateDelete(ctx, id, emailtemplates.DefaultEmailTemplateDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EmailTemplatesClient.EmailTemplateGet` + +```go +ctx := context.TODO() +id := emailtemplates.NewTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "accountClosedDeveloper") + +read, err := client.EmailTemplateGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EmailTemplatesClient.EmailTemplateGetEntityTag` + +```go +ctx := context.TODO() +id := emailtemplates.NewTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "accountClosedDeveloper") + +read, err := client.EmailTemplateGetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EmailTemplatesClient.EmailTemplateUpdate` + +```go +ctx := context.TODO() +id := emailtemplates.NewTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "accountClosedDeveloper") + +payload := emailtemplates.EmailTemplateUpdateParameters{ + // ... +} + + +read, err := client.EmailTemplateUpdate(ctx, id, payload, emailtemplates.DefaultEmailTemplateUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/client.go new file mode 100644 index 000000000000..9f3bc8ed59b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/client.go @@ -0,0 +1,26 @@ +package emailtemplates + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplatesClient struct { + Client *resourcemanager.Client +} + +func NewEmailTemplatesClientWithBaseURI(sdkApi sdkEnv.Api) (*EmailTemplatesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "emailtemplates", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating EmailTemplatesClient: %+v", err) + } + + return &EmailTemplatesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/constants.go new file mode 100644 index 000000000000..19dadfefea49 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/constants.go @@ -0,0 +1,87 @@ +package emailtemplates + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TemplateName string + +const ( + TemplateNameAccountClosedDeveloper TemplateName = "accountClosedDeveloper" + TemplateNameApplicationApprovedNotificationMessage TemplateName = "applicationApprovedNotificationMessage" + TemplateNameConfirmSignUpIdentityDefault TemplateName = "confirmSignUpIdentityDefault" + TemplateNameEmailChangeIdentityDefault TemplateName = "emailChangeIdentityDefault" + TemplateNameInviteUserNotificationMessage TemplateName = "inviteUserNotificationMessage" + TemplateNameNewCommentNotificationMessage TemplateName = "newCommentNotificationMessage" + TemplateNameNewDeveloperNotificationMessage TemplateName = "newDeveloperNotificationMessage" + TemplateNameNewIssueNotificationMessage TemplateName = "newIssueNotificationMessage" + TemplateNamePasswordResetByAdminNotificationMessage TemplateName = "passwordResetByAdminNotificationMessage" + TemplateNamePasswordResetIdentityDefault TemplateName = "passwordResetIdentityDefault" + TemplateNamePurchaseDeveloperNotificationMessage TemplateName = "purchaseDeveloperNotificationMessage" + TemplateNameQuotaLimitApproachingDeveloperNotificationMessage TemplateName = "quotaLimitApproachingDeveloperNotificationMessage" + TemplateNameRejectDeveloperNotificationMessage TemplateName = "rejectDeveloperNotificationMessage" + TemplateNameRequestDeveloperNotificationMessage TemplateName = "requestDeveloperNotificationMessage" +) + +func PossibleValuesForTemplateName() []string { + return []string{ + string(TemplateNameAccountClosedDeveloper), + string(TemplateNameApplicationApprovedNotificationMessage), + string(TemplateNameConfirmSignUpIdentityDefault), + string(TemplateNameEmailChangeIdentityDefault), + string(TemplateNameInviteUserNotificationMessage), + string(TemplateNameNewCommentNotificationMessage), + string(TemplateNameNewDeveloperNotificationMessage), + string(TemplateNameNewIssueNotificationMessage), + string(TemplateNamePasswordResetByAdminNotificationMessage), + string(TemplateNamePasswordResetIdentityDefault), + string(TemplateNamePurchaseDeveloperNotificationMessage), + string(TemplateNameQuotaLimitApproachingDeveloperNotificationMessage), + string(TemplateNameRejectDeveloperNotificationMessage), + string(TemplateNameRequestDeveloperNotificationMessage), + } +} + +func (s *TemplateName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTemplateName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseTemplateName(input string) (*TemplateName, error) { + vals := map[string]TemplateName{ + "accountcloseddeveloper": TemplateNameAccountClosedDeveloper, + "applicationapprovednotificationmessage": TemplateNameApplicationApprovedNotificationMessage, + "confirmsignupidentitydefault": TemplateNameConfirmSignUpIdentityDefault, + "emailchangeidentitydefault": TemplateNameEmailChangeIdentityDefault, + "inviteusernotificationmessage": TemplateNameInviteUserNotificationMessage, + "newcommentnotificationmessage": TemplateNameNewCommentNotificationMessage, + "newdevelopernotificationmessage": TemplateNameNewDeveloperNotificationMessage, + "newissuenotificationmessage": TemplateNameNewIssueNotificationMessage, + "passwordresetbyadminnotificationmessage": TemplateNamePasswordResetByAdminNotificationMessage, + "passwordresetidentitydefault": TemplateNamePasswordResetIdentityDefault, + "purchasedevelopernotificationmessage": TemplateNamePurchaseDeveloperNotificationMessage, + "quotalimitapproachingdevelopernotificationmessage": TemplateNameQuotaLimitApproachingDeveloperNotificationMessage, + "rejectdevelopernotificationmessage": TemplateNameRejectDeveloperNotificationMessage, + "requestdevelopernotificationmessage": TemplateNameRequestDeveloperNotificationMessage, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TemplateName(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/id_template.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/id_template.go new file mode 100644 index 000000000000..c088c6f73c5f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/id_template.go @@ -0,0 +1,156 @@ +package emailtemplates + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = TemplateId{} + +// TemplateId is a struct representing the Resource ID for a Template +type TemplateId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + TemplateName TemplateName +} + +// NewTemplateID returns a new TemplateId struct +func NewTemplateID(subscriptionId string, resourceGroupName string, serviceName string, templateName TemplateName) TemplateId { + return TemplateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + TemplateName: templateName, + } +} + +// ParseTemplateID parses 'input' into a TemplateId +func ParseTemplateID(input string) (*TemplateId, error) { + parser := resourceids.NewParserFromResourceIdType(TemplateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TemplateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if v, ok := parsed.Parsed["templateName"]; true { + if !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "templateName", *parsed) + } + + templateName, err := parseTemplateName(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.TemplateName = *templateName + } + + return &id, nil +} + +// ParseTemplateIDInsensitively parses 'input' case-insensitively into a TemplateId +// note: this method should only be used for API response data and not user input +func ParseTemplateIDInsensitively(input string) (*TemplateId, error) { + parser := resourceids.NewParserFromResourceIdType(TemplateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TemplateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if v, ok := parsed.Parsed["templateName"]; true { + if !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "templateName", *parsed) + } + + templateName, err := parseTemplateName(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.TemplateName = *templateName + } + + return &id, nil +} + +// ValidateTemplateID checks that 'input' can be parsed as a Template ID +func ValidateTemplateID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseTemplateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Template ID +func (id TemplateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/templates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, string(id.TemplateName)) +} + +// Segments returns a slice of Resource ID Segments which comprise this Template ID +func (id TemplateId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticTemplates", "templates", "templates"), + resourceids.ConstantSegment("templateName", PossibleValuesForTemplateName(), "accountClosedDeveloper"), + } +} + +// String returns a human-readable description of this Template ID +func (id TemplateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Template Name: %q", string(id.TemplateName)), + } + return fmt.Sprintf("Template (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatecreateorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatecreateorupdate.go new file mode 100644 index 000000000000..80154b944bc7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatecreateorupdate.go @@ -0,0 +1,85 @@ +package emailtemplates + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *EmailTemplateContract +} + +type EmailTemplateCreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultEmailTemplateCreateOrUpdateOperationOptions() EmailTemplateCreateOrUpdateOperationOptions { + return EmailTemplateCreateOrUpdateOperationOptions{} +} + +func (o EmailTemplateCreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o EmailTemplateCreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o EmailTemplateCreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// EmailTemplateCreateOrUpdate ... +func (c EmailTemplatesClient) EmailTemplateCreateOrUpdate(ctx context.Context, id TemplateId, input EmailTemplateUpdateParameters, options EmailTemplateCreateOrUpdateOperationOptions) (result EmailTemplateCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatedelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatedelete.go new file mode 100644 index 000000000000..0edd892ed234 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatedelete.go @@ -0,0 +1,76 @@ +package emailtemplates + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type EmailTemplateDeleteOperationOptions struct { + IfMatch *string +} + +func DefaultEmailTemplateDeleteOperationOptions() EmailTemplateDeleteOperationOptions { + return EmailTemplateDeleteOperationOptions{} +} + +func (o EmailTemplateDeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o EmailTemplateDeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o EmailTemplateDeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// EmailTemplateDelete ... +func (c EmailTemplatesClient) EmailTemplateDelete(ctx context.Context, id TemplateId, options EmailTemplateDeleteOperationOptions) (result EmailTemplateDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateget.go new file mode 100644 index 000000000000..91bd3f56c3ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateget.go @@ -0,0 +1,51 @@ +package emailtemplates + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *EmailTemplateContract +} + +// EmailTemplateGet ... +func (c EmailTemplatesClient) EmailTemplateGet(ctx context.Context, id TemplateId) (result EmailTemplateGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplategetentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplategetentitytag.go new file mode 100644 index 000000000000..fd7e56165496 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplategetentitytag.go @@ -0,0 +1,46 @@ +package emailtemplates + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateGetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// EmailTemplateGetEntityTag ... +func (c EmailTemplatesClient) EmailTemplateGetEntityTag(ctx context.Context, id TemplateId) (result EmailTemplateGetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateupdate.go new file mode 100644 index 000000000000..5e5c6f703f2f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateupdate.go @@ -0,0 +1,84 @@ +package emailtemplates + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *EmailTemplateContract +} + +type EmailTemplateUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultEmailTemplateUpdateOperationOptions() EmailTemplateUpdateOperationOptions { + return EmailTemplateUpdateOperationOptions{} +} + +func (o EmailTemplateUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o EmailTemplateUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o EmailTemplateUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// EmailTemplateUpdate ... +func (c EmailTemplatesClient) EmailTemplateUpdate(ctx context.Context, id TemplateId, input EmailTemplateUpdateParameters, options EmailTemplateUpdateOperationOptions) (result EmailTemplateUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplatecontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplatecontract.go new file mode 100644 index 000000000000..185b3b6daf66 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplatecontract.go @@ -0,0 +1,11 @@ +package emailtemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *EmailTemplateContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplatecontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplatecontractproperties.go new file mode 100644 index 000000000000..583e1fc76629 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplatecontractproperties.go @@ -0,0 +1,13 @@ +package emailtemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateContractProperties struct { + Body string `json:"body"` + Description *string `json:"description,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` + Parameters *[]EmailTemplateParametersContractProperties `json:"parameters,omitempty"` + Subject string `json:"subject"` + Title *string `json:"title,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplateparameterscontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplateparameterscontractproperties.go new file mode 100644 index 000000000000..9b416504c7d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplateparameterscontractproperties.go @@ -0,0 +1,10 @@ +package emailtemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateParametersContractProperties struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + Title *string `json:"title,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplateupdateparameterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplateupdateparameterproperties.go new file mode 100644 index 000000000000..a0d7fa1cde11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplateupdateparameterproperties.go @@ -0,0 +1,12 @@ +package emailtemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateUpdateParameterProperties struct { + Body *string `json:"body,omitempty"` + Description *string `json:"description,omitempty"` + Parameters *[]EmailTemplateParametersContractProperties `json:"parameters,omitempty"` + Subject *string `json:"subject,omitempty"` + Title *string `json:"title,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplateupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplateupdateparameters.go new file mode 100644 index 000000000000..d6fbb25c10bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/model_emailtemplateupdateparameters.go @@ -0,0 +1,8 @@ +package emailtemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateUpdateParameters struct { + Properties *EmailTemplateUpdateParameterProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/version.go new file mode 100644 index 000000000000..d8f556de56c8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates/version.go @@ -0,0 +1,12 @@ +package emailtemplates + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/emailtemplates/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/README.md new file mode 100644 index 000000000000..11ff749a833d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway` Documentation + +The `gateway` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway" +``` + + +### Client Initialization + +```go +client := gateway.NewGatewayClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `GatewayClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := gateway.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue") + +payload := gateway.GatewayContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, gateway.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GatewayClient.Delete` + +```go +ctx := context.TODO() +id := gateway.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue") + +read, err := client.Delete(ctx, id, gateway.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GatewayClient.Get` + +```go +ctx := context.TODO() +id := gateway.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GatewayClient.GetEntityTag` + +```go +ctx := context.TODO() +id := gateway.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GatewayClient.ListByService` + +```go +ctx := context.TODO() +id := gateway.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, gateway.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, gateway.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `GatewayClient.Update` + +```go +ctx := context.TODO() +id := gateway.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue") + +payload := gateway.GatewayContract{ + // ... +} + + +read, err := client.Update(ctx, id, payload, gateway.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/client.go new file mode 100644 index 000000000000..0d22b6f29bb9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/client.go @@ -0,0 +1,26 @@ +package gateway + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayClient struct { + Client *resourcemanager.Client +} + +func NewGatewayClientWithBaseURI(sdkApi sdkEnv.Api) (*GatewayClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "gateway", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayClient: %+v", err) + } + + return &GatewayClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/id_gateway.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/id_gateway.go new file mode 100644 index 000000000000..34550bb3edcf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/id_gateway.go @@ -0,0 +1,140 @@ +package gateway + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = GatewayId{} + +// GatewayId is a struct representing the Resource ID for a Gateway +type GatewayId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + GatewayId string +} + +// NewGatewayID returns a new GatewayId struct +func NewGatewayID(subscriptionId string, resourceGroupName string, serviceName string, gatewayId string) GatewayId { + return GatewayId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + GatewayId: gatewayId, + } +} + +// ParseGatewayID parses 'input' into a GatewayId +func ParseGatewayID(input string) (*GatewayId, error) { + parser := resourceids.NewParserFromResourceIdType(GatewayId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GatewayId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + } + + return &id, nil +} + +// ParseGatewayIDInsensitively parses 'input' case-insensitively into a GatewayId +// note: this method should only be used for API response data and not user input +func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { + parser := resourceids.NewParserFromResourceIdType(GatewayId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GatewayId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + } + + return &id, nil +} + +// ValidateGatewayID checks that 'input' can be parsed as a Gateway ID +func ValidateGatewayID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseGatewayID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Gateway ID +func (id GatewayId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/gateways/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.GatewayId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Gateway ID +func (id GatewayId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticGateways", "gateways", "gateways"), + resourceids.UserSpecifiedSegment("gatewayId", "gatewayIdValue"), + } +} + +// String returns a human-readable description of this Gateway ID +func (id GatewayId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Gateway: %q", id.GatewayId), + } + return fmt.Sprintf("Gateway (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/id_service.go new file mode 100644 index 000000000000..a45df593cf65 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/id_service.go @@ -0,0 +1,127 @@ +package gateway + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_createorupdate.go new file mode 100644 index 000000000000..b166d062bf3f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_createorupdate.go @@ -0,0 +1,85 @@ +package gateway + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c GatewayClient) CreateOrUpdate(ctx context.Context, id GatewayId, input GatewayContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_delete.go new file mode 100644 index 000000000000..34c8698ad34e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_delete.go @@ -0,0 +1,76 @@ +package gateway + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c GatewayClient) Delete(ctx context.Context, id GatewayId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_get.go new file mode 100644 index 000000000000..73393157e027 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_get.go @@ -0,0 +1,51 @@ +package gateway + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayContract +} + +// Get ... +func (c GatewayClient) Get(ctx context.Context, id GatewayId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_getentitytag.go new file mode 100644 index 000000000000..34c8cd8439b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_getentitytag.go @@ -0,0 +1,46 @@ +package gateway + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GatewayClient) GetEntityTag(ctx context.Context, id GatewayId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_listbyservice.go new file mode 100644 index 000000000000..2e1953f23da9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_listbyservice.go @@ -0,0 +1,125 @@ +package gateway + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GatewayContract +} + +type ListByServiceCompleteResult struct { + Items []GatewayContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c GatewayClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/gateways", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GatewayContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c GatewayClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GatewayContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GatewayClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate GatewayContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]GatewayContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_update.go new file mode 100644 index 000000000000..fcf2126f5bd5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/method_update.go @@ -0,0 +1,84 @@ +package gateway + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c GatewayClient) Update(ctx context.Context, id GatewayId, input GatewayContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/model_gatewaycontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/model_gatewaycontract.go new file mode 100644 index 000000000000..a39a34cac7ff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/model_gatewaycontract.go @@ -0,0 +1,11 @@ +package gateway + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *GatewayContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/model_gatewaycontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/model_gatewaycontractproperties.go new file mode 100644 index 000000000000..5f103c064ef5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/model_gatewaycontractproperties.go @@ -0,0 +1,9 @@ +package gateway + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayContractProperties struct { + Description *string `json:"description,omitempty"` + LocationData *ResourceLocationDataContract `json:"locationData,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/model_resourcelocationdatacontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/model_resourcelocationdatacontract.go new file mode 100644 index 000000000000..75a50900788c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/model_resourcelocationdatacontract.go @@ -0,0 +1,11 @@ +package gateway + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceLocationDataContract struct { + City *string `json:"city,omitempty"` + CountryOrRegion *string `json:"countryOrRegion,omitempty"` + District *string `json:"district,omitempty"` + Name string `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/predicates.go new file mode 100644 index 000000000000..e3df21dd4c00 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/predicates.go @@ -0,0 +1,27 @@ +package gateway + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p GatewayContractOperationPredicate) Matches(input GatewayContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/version.go new file mode 100644 index 000000000000..9771e9409e3d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway/version.go @@ -0,0 +1,12 @@ +package gateway + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/gateway/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/README.md new file mode 100644 index 000000000000..93a1921677aa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi` Documentation + +The `gatewayapi` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi" +``` + + +### Client Initialization + +```go +client := gatewayapi.NewGatewayApiClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `GatewayApiClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := gatewayapi.NewGatewayApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue", "apiIdValue") + +payload := gatewayapi.AssociationContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GatewayApiClient.Delete` + +```go +ctx := context.TODO() +id := gatewayapi.NewGatewayApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue", "apiIdValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GatewayApiClient.GetEntityTag` + +```go +ctx := context.TODO() +id := gatewayapi.NewGatewayApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue", "apiIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GatewayApiClient.ListByService` + +```go +ctx := context.TODO() +id := gatewayapi.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue") + +// alternatively `client.ListByService(ctx, id, gatewayapi.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, gatewayapi.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/client.go new file mode 100644 index 000000000000..6f88d7098fda --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/client.go @@ -0,0 +1,26 @@ +package gatewayapi + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayApiClient struct { + Client *resourcemanager.Client +} + +func NewGatewayApiClientWithBaseURI(sdkApi sdkEnv.Api) (*GatewayApiClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "gatewayapi", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayApiClient: %+v", err) + } + + return &GatewayApiClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/constants.go new file mode 100644 index 000000000000..0da8f5690397 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/constants.go @@ -0,0 +1,227 @@ +package gatewayapi + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiType string + +const ( + ApiTypeGraphql ApiType = "graphql" + ApiTypeHTTP ApiType = "http" + ApiTypeSoap ApiType = "soap" + ApiTypeWebsocket ApiType = "websocket" +) + +func PossibleValuesForApiType() []string { + return []string{ + string(ApiTypeGraphql), + string(ApiTypeHTTP), + string(ApiTypeSoap), + string(ApiTypeWebsocket), + } +} + +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApiType(input string) (*ApiType, error) { + vals := map[string]ApiType{ + "graphql": ApiTypeGraphql, + "http": ApiTypeHTTP, + "soap": ApiTypeSoap, + "websocket": ApiTypeWebsocket, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApiType(input) + return &out, nil +} + +type BearerTokenSendingMethods string + +const ( + BearerTokenSendingMethodsAuthorizationHeader BearerTokenSendingMethods = "authorizationHeader" + BearerTokenSendingMethodsQuery BearerTokenSendingMethods = "query" +) + +func PossibleValuesForBearerTokenSendingMethods() []string { + return []string{ + string(BearerTokenSendingMethodsAuthorizationHeader), + string(BearerTokenSendingMethodsQuery), + } +} + +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { + vals := map[string]BearerTokenSendingMethods{ + "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, + "query": BearerTokenSendingMethodsQuery, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BearerTokenSendingMethods(input) + return &out, nil +} + +type Protocol string + +const ( + ProtocolHTTP Protocol = "http" + ProtocolHTTPS Protocol = "https" + ProtocolWs Protocol = "ws" + ProtocolWss Protocol = "wss" +) + +func PossibleValuesForProtocol() []string { + return []string{ + string(ProtocolHTTP), + string(ProtocolHTTPS), + string(ProtocolWs), + string(ProtocolWss), + } +} + +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocol(input string) (*Protocol, error) { + vals := map[string]Protocol{ + "http": ProtocolHTTP, + "https": ProtocolHTTPS, + "ws": ProtocolWs, + "wss": ProtocolWss, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Protocol(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCreated ProvisioningState = "created" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreated), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "created": ProvisioningStateCreated, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type VersioningScheme string + +const ( + VersioningSchemeHeader VersioningScheme = "Header" + VersioningSchemeQuery VersioningScheme = "Query" + VersioningSchemeSegment VersioningScheme = "Segment" +) + +func PossibleValuesForVersioningScheme() []string { + return []string{ + string(VersioningSchemeHeader), + string(VersioningSchemeQuery), + string(VersioningSchemeSegment), + } +} + +func (s *VersioningScheme) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVersioningScheme(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVersioningScheme(input string) (*VersioningScheme, error) { + vals := map[string]VersioningScheme{ + "header": VersioningSchemeHeader, + "query": VersioningSchemeQuery, + "segment": VersioningSchemeSegment, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VersioningScheme(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gateway.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gateway.go new file mode 100644 index 000000000000..4165de54710a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gateway.go @@ -0,0 +1,140 @@ +package gatewayapi + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = GatewayId{} + +// GatewayId is a struct representing the Resource ID for a Gateway +type GatewayId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + GatewayId string +} + +// NewGatewayID returns a new GatewayId struct +func NewGatewayID(subscriptionId string, resourceGroupName string, serviceName string, gatewayId string) GatewayId { + return GatewayId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + GatewayId: gatewayId, + } +} + +// ParseGatewayID parses 'input' into a GatewayId +func ParseGatewayID(input string) (*GatewayId, error) { + parser := resourceids.NewParserFromResourceIdType(GatewayId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GatewayId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + } + + return &id, nil +} + +// ParseGatewayIDInsensitively parses 'input' case-insensitively into a GatewayId +// note: this method should only be used for API response data and not user input +func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { + parser := resourceids.NewParserFromResourceIdType(GatewayId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GatewayId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + } + + return &id, nil +} + +// ValidateGatewayID checks that 'input' can be parsed as a Gateway ID +func ValidateGatewayID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseGatewayID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Gateway ID +func (id GatewayId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/gateways/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.GatewayId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Gateway ID +func (id GatewayId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticGateways", "gateways", "gateways"), + resourceids.UserSpecifiedSegment("gatewayId", "gatewayIdValue"), + } +} + +// String returns a human-readable description of this Gateway ID +func (id GatewayId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Gateway: %q", id.GatewayId), + } + return fmt.Sprintf("Gateway (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gatewayapi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gatewayapi.go new file mode 100644 index 000000000000..7dc333eb0d36 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gatewayapi.go @@ -0,0 +1,153 @@ +package gatewayapi + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = GatewayApiId{} + +// GatewayApiId is a struct representing the Resource ID for a Gateway Api +type GatewayApiId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + GatewayId string + ApiId string +} + +// NewGatewayApiID returns a new GatewayApiId struct +func NewGatewayApiID(subscriptionId string, resourceGroupName string, serviceName string, gatewayId string, apiId string) GatewayApiId { + return GatewayApiId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + GatewayId: gatewayId, + ApiId: apiId, + } +} + +// ParseGatewayApiID parses 'input' into a GatewayApiId +func ParseGatewayApiID(input string) (*GatewayApiId, error) { + parser := resourceids.NewParserFromResourceIdType(GatewayApiId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GatewayApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ParseGatewayApiIDInsensitively parses 'input' case-insensitively into a GatewayApiId +// note: this method should only be used for API response data and not user input +func ParseGatewayApiIDInsensitively(input string) (*GatewayApiId, error) { + parser := resourceids.NewParserFromResourceIdType(GatewayApiId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GatewayApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ValidateGatewayApiID checks that 'input' can be parsed as a Gateway Api ID +func ValidateGatewayApiID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseGatewayApiID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Gateway Api ID +func (id GatewayApiId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/gateways/%s/apis/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.GatewayId, id.ApiId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Gateway Api ID +func (id GatewayApiId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticGateways", "gateways", "gateways"), + resourceids.UserSpecifiedSegment("gatewayId", "gatewayIdValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + } +} + +// String returns a human-readable description of this Gateway Api ID +func (id GatewayApiId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Gateway: %q", id.GatewayId), + fmt.Sprintf("Api: %q", id.ApiId), + } + return fmt.Sprintf("Gateway Api (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_createorupdate.go new file mode 100644 index 000000000000..8fd635de8769 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_createorupdate.go @@ -0,0 +1,56 @@ +package gatewayapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiContract +} + +// CreateOrUpdate ... +func (c GatewayApiClient) CreateOrUpdate(ctx context.Context, id GatewayApiId, input AssociationContract) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_delete.go new file mode 100644 index 000000000000..293176f784aa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_delete.go @@ -0,0 +1,47 @@ +package gatewayapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c GatewayApiClient) Delete(ctx context.Context, id GatewayApiId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_getentitytag.go new file mode 100644 index 000000000000..e14c0b61f72a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_getentitytag.go @@ -0,0 +1,46 @@ +package gatewayapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GatewayApiClient) GetEntityTag(ctx context.Context, id GatewayApiId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_listbyservice.go new file mode 100644 index 000000000000..478f87c8195c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/method_listbyservice.go @@ -0,0 +1,125 @@ +package gatewayapi + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiContract +} + +type ListByServiceCompleteResult struct { + Items []ApiContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c GatewayApiClient) ListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/apis", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c GatewayApiClient) ListByServiceComplete(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GatewayApiClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id GatewayId, options ListByServiceOperationOptions, predicate ApiContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ApiContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apicontactinformation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apicontactinformation.go new file mode 100644 index 000000000000..b1c3688ef45b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apicontactinformation.go @@ -0,0 +1,10 @@ +package gatewayapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiContactInformation struct { + Email *string `json:"email,omitempty"` + Name *string `json:"name,omitempty"` + Url *string `json:"url,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apicontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apicontract.go new file mode 100644 index 000000000000..fe7b4bd59da9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apicontract.go @@ -0,0 +1,11 @@ +package gatewayapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ApiContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apicontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apicontractproperties.go new file mode 100644 index 000000000000..b6730933ec82 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apicontractproperties.go @@ -0,0 +1,28 @@ +package gatewayapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiContractProperties struct { + ApiRevision *string `json:"apiRevision,omitempty"` + ApiRevisionDescription *string `json:"apiRevisionDescription,omitempty"` + ApiVersion *string `json:"apiVersion,omitempty"` + ApiVersionDescription *string `json:"apiVersionDescription,omitempty"` + ApiVersionSet *ApiVersionSetContractDetails `json:"apiVersionSet,omitempty"` + ApiVersionSetId *string `json:"apiVersionSetId,omitempty"` + AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` + Contact *ApiContactInformation `json:"contact,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + IsCurrent *bool `json:"isCurrent,omitempty"` + IsOnline *bool `json:"isOnline,omitempty"` + License *ApiLicenseInformation `json:"license,omitempty"` + Path string `json:"path"` + Protocols *[]Protocol `json:"protocols,omitempty"` + ServiceUrl *string `json:"serviceUrl,omitempty"` + SourceApiId *string `json:"sourceApiId,omitempty"` + SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` + SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` + TermsOfServiceUrl *string `json:"termsOfServiceUrl,omitempty"` + Type *ApiType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apilicenseinformation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apilicenseinformation.go new file mode 100644 index 000000000000..287962be3e7d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apilicenseinformation.go @@ -0,0 +1,9 @@ +package gatewayapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiLicenseInformation struct { + Name *string `json:"name,omitempty"` + Url *string `json:"url,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apiversionsetcontractdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apiversionsetcontractdetails.go new file mode 100644 index 000000000000..7bbb4ab4222f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_apiversionsetcontractdetails.go @@ -0,0 +1,13 @@ +package gatewayapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiVersionSetContractDetails struct { + Description *string `json:"description,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + VersionHeaderName *string `json:"versionHeaderName,omitempty"` + VersionQueryName *string `json:"versionQueryName,omitempty"` + VersioningScheme *VersioningScheme `json:"versioningScheme,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_associationcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_associationcontract.go new file mode 100644 index 000000000000..8ec8abebbf54 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_associationcontract.go @@ -0,0 +1,11 @@ +package gatewayapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssociationContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AssociationContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_associationcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_associationcontractproperties.go new file mode 100644 index 000000000000..c1b4895fd815 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_associationcontractproperties.go @@ -0,0 +1,8 @@ +package gatewayapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssociationContractProperties struct { + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_authenticationsettingscontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_authenticationsettingscontract.go new file mode 100644 index 000000000000..662618b95d86 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_authenticationsettingscontract.go @@ -0,0 +1,9 @@ +package gatewayapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthenticationSettingsContract struct { + OAuth2 *OAuth2AuthenticationSettingsContract `json:"oAuth2,omitempty"` + Openid *OpenIdAuthenticationSettingsContract `json:"openid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_oauth2authenticationsettingscontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_oauth2authenticationsettingscontract.go new file mode 100644 index 000000000000..1362d06b8735 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_oauth2authenticationsettingscontract.go @@ -0,0 +1,9 @@ +package gatewayapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OAuth2AuthenticationSettingsContract struct { + AuthorizationServerId *string `json:"authorizationServerId,omitempty"` + Scope *string `json:"scope,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_openidauthenticationsettingscontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_openidauthenticationsettingscontract.go new file mode 100644 index 000000000000..4bd4b6e78bc8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_openidauthenticationsettingscontract.go @@ -0,0 +1,9 @@ +package gatewayapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OpenIdAuthenticationSettingsContract struct { + BearerTokenSendingMethods *[]BearerTokenSendingMethods `json:"bearerTokenSendingMethods,omitempty"` + OpenidProviderId *string `json:"openidProviderId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_subscriptionkeyparameternamescontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_subscriptionkeyparameternamescontract.go new file mode 100644 index 000000000000..2548329e0b9b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/model_subscriptionkeyparameternamescontract.go @@ -0,0 +1,9 @@ +package gatewayapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionKeyParameterNamesContract struct { + Header *string `json:"header,omitempty"` + Query *string `json:"query,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/predicates.go new file mode 100644 index 000000000000..46947f214783 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/predicates.go @@ -0,0 +1,27 @@ +package gatewayapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ApiContractOperationPredicate) Matches(input ApiContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/version.go new file mode 100644 index 000000000000..aad32adfa3bc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi/version.go @@ -0,0 +1,12 @@ +package gatewayapi + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/gatewayapi/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/README.md new file mode 100644 index 000000000000..280af3e437b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/README.md @@ -0,0 +1,106 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority` Documentation + +The `gatewaycertificateauthority` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority" +``` + + +### Client Initialization + +```go +client := gatewaycertificateauthority.NewGatewayCertificateAuthorityClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `GatewayCertificateAuthorityClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := gatewaycertificateauthority.NewCertificateAuthorityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue", "certificateIdValue") + +payload := gatewaycertificateauthority.GatewayCertificateAuthorityContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, gatewaycertificateauthority.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GatewayCertificateAuthorityClient.Delete` + +```go +ctx := context.TODO() +id := gatewaycertificateauthority.NewCertificateAuthorityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue", "certificateIdValue") + +read, err := client.Delete(ctx, id, gatewaycertificateauthority.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GatewayCertificateAuthorityClient.Get` + +```go +ctx := context.TODO() +id := gatewaycertificateauthority.NewCertificateAuthorityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue", "certificateIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GatewayCertificateAuthorityClient.GetEntityTag` + +```go +ctx := context.TODO() +id := gatewaycertificateauthority.NewCertificateAuthorityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue", "certificateIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GatewayCertificateAuthorityClient.ListByService` + +```go +ctx := context.TODO() +id := gatewaycertificateauthority.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue") + +// alternatively `client.ListByService(ctx, id, gatewaycertificateauthority.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, gatewaycertificateauthority.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/client.go new file mode 100644 index 000000000000..82e3bc25dd68 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/client.go @@ -0,0 +1,26 @@ +package gatewaycertificateauthority + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayCertificateAuthorityClient struct { + Client *resourcemanager.Client +} + +func NewGatewayCertificateAuthorityClientWithBaseURI(sdkApi sdkEnv.Api) (*GatewayCertificateAuthorityClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "gatewaycertificateauthority", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayCertificateAuthorityClient: %+v", err) + } + + return &GatewayCertificateAuthorityClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_certificateauthority.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_certificateauthority.go new file mode 100644 index 000000000000..237095225f1d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_certificateauthority.go @@ -0,0 +1,153 @@ +package gatewaycertificateauthority + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = CertificateAuthorityId{} + +// CertificateAuthorityId is a struct representing the Resource ID for a Certificate Authority +type CertificateAuthorityId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + GatewayId string + CertificateId string +} + +// NewCertificateAuthorityID returns a new CertificateAuthorityId struct +func NewCertificateAuthorityID(subscriptionId string, resourceGroupName string, serviceName string, gatewayId string, certificateId string) CertificateAuthorityId { + return CertificateAuthorityId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + GatewayId: gatewayId, + CertificateId: certificateId, + } +} + +// ParseCertificateAuthorityID parses 'input' into a CertificateAuthorityId +func ParseCertificateAuthorityID(input string) (*CertificateAuthorityId, error) { + parser := resourceids.NewParserFromResourceIdType(CertificateAuthorityId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CertificateAuthorityId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + } + + if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + } + + return &id, nil +} + +// ParseCertificateAuthorityIDInsensitively parses 'input' case-insensitively into a CertificateAuthorityId +// note: this method should only be used for API response data and not user input +func ParseCertificateAuthorityIDInsensitively(input string) (*CertificateAuthorityId, error) { + parser := resourceids.NewParserFromResourceIdType(CertificateAuthorityId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CertificateAuthorityId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + } + + if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + } + + return &id, nil +} + +// ValidateCertificateAuthorityID checks that 'input' can be parsed as a Certificate Authority ID +func ValidateCertificateAuthorityID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCertificateAuthorityID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Certificate Authority ID +func (id CertificateAuthorityId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/gateways/%s/certificateAuthorities/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.GatewayId, id.CertificateId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Certificate Authority ID +func (id CertificateAuthorityId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticGateways", "gateways", "gateways"), + resourceids.UserSpecifiedSegment("gatewayId", "gatewayIdValue"), + resourceids.StaticSegment("staticCertificateAuthorities", "certificateAuthorities", "certificateAuthorities"), + resourceids.UserSpecifiedSegment("certificateId", "certificateIdValue"), + } +} + +// String returns a human-readable description of this Certificate Authority ID +func (id CertificateAuthorityId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Gateway: %q", id.GatewayId), + fmt.Sprintf("Certificate: %q", id.CertificateId), + } + return fmt.Sprintf("Certificate Authority (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_gateway.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_gateway.go new file mode 100644 index 000000000000..787e1bc3e37f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_gateway.go @@ -0,0 +1,140 @@ +package gatewaycertificateauthority + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = GatewayId{} + +// GatewayId is a struct representing the Resource ID for a Gateway +type GatewayId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + GatewayId string +} + +// NewGatewayID returns a new GatewayId struct +func NewGatewayID(subscriptionId string, resourceGroupName string, serviceName string, gatewayId string) GatewayId { + return GatewayId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + GatewayId: gatewayId, + } +} + +// ParseGatewayID parses 'input' into a GatewayId +func ParseGatewayID(input string) (*GatewayId, error) { + parser := resourceids.NewParserFromResourceIdType(GatewayId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GatewayId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + } + + return &id, nil +} + +// ParseGatewayIDInsensitively parses 'input' case-insensitively into a GatewayId +// note: this method should only be used for API response data and not user input +func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { + parser := resourceids.NewParserFromResourceIdType(GatewayId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GatewayId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + } + + return &id, nil +} + +// ValidateGatewayID checks that 'input' can be parsed as a Gateway ID +func ValidateGatewayID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseGatewayID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Gateway ID +func (id GatewayId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/gateways/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.GatewayId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Gateway ID +func (id GatewayId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticGateways", "gateways", "gateways"), + resourceids.UserSpecifiedSegment("gatewayId", "gatewayIdValue"), + } +} + +// String returns a human-readable description of this Gateway ID +func (id GatewayId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Gateway: %q", id.GatewayId), + } + return fmt.Sprintf("Gateway (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_createorupdate.go new file mode 100644 index 000000000000..a982aaf94c4e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_createorupdate.go @@ -0,0 +1,85 @@ +package gatewaycertificateauthority + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayCertificateAuthorityContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c GatewayCertificateAuthorityClient) CreateOrUpdate(ctx context.Context, id CertificateAuthorityId, input GatewayCertificateAuthorityContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_delete.go new file mode 100644 index 000000000000..ee1deb63010f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_delete.go @@ -0,0 +1,76 @@ +package gatewaycertificateauthority + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c GatewayCertificateAuthorityClient) Delete(ctx context.Context, id CertificateAuthorityId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_get.go new file mode 100644 index 000000000000..12ff864df7c8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_get.go @@ -0,0 +1,51 @@ +package gatewaycertificateauthority + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayCertificateAuthorityContract +} + +// Get ... +func (c GatewayCertificateAuthorityClient) Get(ctx context.Context, id CertificateAuthorityId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_getentitytag.go new file mode 100644 index 000000000000..cc382dbb6d8e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_getentitytag.go @@ -0,0 +1,46 @@ +package gatewaycertificateauthority + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GatewayCertificateAuthorityClient) GetEntityTag(ctx context.Context, id CertificateAuthorityId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_listbyservice.go new file mode 100644 index 000000000000..3b24a4a53a6e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_listbyservice.go @@ -0,0 +1,125 @@ +package gatewaycertificateauthority + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GatewayCertificateAuthorityContract +} + +type ListByServiceCompleteResult struct { + Items []GatewayCertificateAuthorityContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c GatewayCertificateAuthorityClient) ListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/certificateAuthorities", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GatewayCertificateAuthorityContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c GatewayCertificateAuthorityClient) ListByServiceComplete(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GatewayCertificateAuthorityContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GatewayCertificateAuthorityClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id GatewayId, options ListByServiceOperationOptions, predicate GatewayCertificateAuthorityContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]GatewayCertificateAuthorityContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/model_gatewaycertificateauthoritycontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/model_gatewaycertificateauthoritycontract.go new file mode 100644 index 000000000000..c16f0cbeb3e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/model_gatewaycertificateauthoritycontract.go @@ -0,0 +1,11 @@ +package gatewaycertificateauthority + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayCertificateAuthorityContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *GatewayCertificateAuthorityContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/model_gatewaycertificateauthoritycontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/model_gatewaycertificateauthoritycontractproperties.go new file mode 100644 index 000000000000..204ec98b3006 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/model_gatewaycertificateauthoritycontractproperties.go @@ -0,0 +1,8 @@ +package gatewaycertificateauthority + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayCertificateAuthorityContractProperties struct { + IsTrusted *bool `json:"isTrusted,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/predicates.go new file mode 100644 index 000000000000..10927ccab9f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/predicates.go @@ -0,0 +1,27 @@ +package gatewaycertificateauthority + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayCertificateAuthorityContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p GatewayCertificateAuthorityContractOperationPredicate) Matches(input GatewayCertificateAuthorityContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/version.go new file mode 100644 index 000000000000..8b44c6abd7f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/version.go @@ -0,0 +1,12 @@ +package gatewaycertificateauthority + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/gatewaycertificateauthority/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/README.md new file mode 100644 index 000000000000..e649005ea840 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/README.md @@ -0,0 +1,106 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration` Documentation + +The `gatewayhostnameconfiguration` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration" +``` + + +### Client Initialization + +```go +client := gatewayhostnameconfiguration.NewGatewayHostnameConfigurationClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `GatewayHostnameConfigurationClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := gatewayhostnameconfiguration.NewHostnameConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue", "hcIdValue") + +payload := gatewayhostnameconfiguration.GatewayHostnameConfigurationContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, gatewayhostnameconfiguration.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GatewayHostnameConfigurationClient.Delete` + +```go +ctx := context.TODO() +id := gatewayhostnameconfiguration.NewHostnameConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue", "hcIdValue") + +read, err := client.Delete(ctx, id, gatewayhostnameconfiguration.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GatewayHostnameConfigurationClient.Get` + +```go +ctx := context.TODO() +id := gatewayhostnameconfiguration.NewHostnameConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue", "hcIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GatewayHostnameConfigurationClient.GetEntityTag` + +```go +ctx := context.TODO() +id := gatewayhostnameconfiguration.NewHostnameConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue", "hcIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GatewayHostnameConfigurationClient.ListByService` + +```go +ctx := context.TODO() +id := gatewayhostnameconfiguration.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "gatewayIdValue") + +// alternatively `client.ListByService(ctx, id, gatewayhostnameconfiguration.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, gatewayhostnameconfiguration.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/client.go new file mode 100644 index 000000000000..caf1c71d205d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/client.go @@ -0,0 +1,26 @@ +package gatewayhostnameconfiguration + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayHostnameConfigurationClient struct { + Client *resourcemanager.Client +} + +func NewGatewayHostnameConfigurationClientWithBaseURI(sdkApi sdkEnv.Api) (*GatewayHostnameConfigurationClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "gatewayhostnameconfiguration", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayHostnameConfigurationClient: %+v", err) + } + + return &GatewayHostnameConfigurationClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_gateway.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_gateway.go new file mode 100644 index 000000000000..db58fe2a01da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_gateway.go @@ -0,0 +1,140 @@ +package gatewayhostnameconfiguration + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = GatewayId{} + +// GatewayId is a struct representing the Resource ID for a Gateway +type GatewayId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + GatewayId string +} + +// NewGatewayID returns a new GatewayId struct +func NewGatewayID(subscriptionId string, resourceGroupName string, serviceName string, gatewayId string) GatewayId { + return GatewayId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + GatewayId: gatewayId, + } +} + +// ParseGatewayID parses 'input' into a GatewayId +func ParseGatewayID(input string) (*GatewayId, error) { + parser := resourceids.NewParserFromResourceIdType(GatewayId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GatewayId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + } + + return &id, nil +} + +// ParseGatewayIDInsensitively parses 'input' case-insensitively into a GatewayId +// note: this method should only be used for API response data and not user input +func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { + parser := resourceids.NewParserFromResourceIdType(GatewayId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GatewayId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + } + + return &id, nil +} + +// ValidateGatewayID checks that 'input' can be parsed as a Gateway ID +func ValidateGatewayID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseGatewayID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Gateway ID +func (id GatewayId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/gateways/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.GatewayId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Gateway ID +func (id GatewayId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticGateways", "gateways", "gateways"), + resourceids.UserSpecifiedSegment("gatewayId", "gatewayIdValue"), + } +} + +// String returns a human-readable description of this Gateway ID +func (id GatewayId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Gateway: %q", id.GatewayId), + } + return fmt.Sprintf("Gateway (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_hostnameconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_hostnameconfiguration.go new file mode 100644 index 000000000000..6161f4486569 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_hostnameconfiguration.go @@ -0,0 +1,153 @@ +package gatewayhostnameconfiguration + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = HostnameConfigurationId{} + +// HostnameConfigurationId is a struct representing the Resource ID for a Hostname Configuration +type HostnameConfigurationId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + GatewayId string + HcId string +} + +// NewHostnameConfigurationID returns a new HostnameConfigurationId struct +func NewHostnameConfigurationID(subscriptionId string, resourceGroupName string, serviceName string, gatewayId string, hcId string) HostnameConfigurationId { + return HostnameConfigurationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + GatewayId: gatewayId, + HcId: hcId, + } +} + +// ParseHostnameConfigurationID parses 'input' into a HostnameConfigurationId +func ParseHostnameConfigurationID(input string) (*HostnameConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(HostnameConfigurationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostnameConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + } + + if id.HcId, ok = parsed.Parsed["hcId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "hcId", *parsed) + } + + return &id, nil +} + +// ParseHostnameConfigurationIDInsensitively parses 'input' case-insensitively into a HostnameConfigurationId +// note: this method should only be used for API response data and not user input +func ParseHostnameConfigurationIDInsensitively(input string) (*HostnameConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(HostnameConfigurationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostnameConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + } + + if id.HcId, ok = parsed.Parsed["hcId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "hcId", *parsed) + } + + return &id, nil +} + +// ValidateHostnameConfigurationID checks that 'input' can be parsed as a Hostname Configuration ID +func ValidateHostnameConfigurationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseHostnameConfigurationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Hostname Configuration ID +func (id HostnameConfigurationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/gateways/%s/hostnameConfigurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.GatewayId, id.HcId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Hostname Configuration ID +func (id HostnameConfigurationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticGateways", "gateways", "gateways"), + resourceids.UserSpecifiedSegment("gatewayId", "gatewayIdValue"), + resourceids.StaticSegment("staticHostnameConfigurations", "hostnameConfigurations", "hostnameConfigurations"), + resourceids.UserSpecifiedSegment("hcId", "hcIdValue"), + } +} + +// String returns a human-readable description of this Hostname Configuration ID +func (id HostnameConfigurationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Gateway: %q", id.GatewayId), + fmt.Sprintf("Hc: %q", id.HcId), + } + return fmt.Sprintf("Hostname Configuration (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_createorupdate.go new file mode 100644 index 000000000000..1a362be1c963 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_createorupdate.go @@ -0,0 +1,85 @@ +package gatewayhostnameconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayHostnameConfigurationContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c GatewayHostnameConfigurationClient) CreateOrUpdate(ctx context.Context, id HostnameConfigurationId, input GatewayHostnameConfigurationContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_delete.go new file mode 100644 index 000000000000..d36e0d55e202 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_delete.go @@ -0,0 +1,76 @@ +package gatewayhostnameconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c GatewayHostnameConfigurationClient) Delete(ctx context.Context, id HostnameConfigurationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_get.go new file mode 100644 index 000000000000..f1f5ec6b270e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_get.go @@ -0,0 +1,51 @@ +package gatewayhostnameconfiguration + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayHostnameConfigurationContract +} + +// Get ... +func (c GatewayHostnameConfigurationClient) Get(ctx context.Context, id HostnameConfigurationId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_getentitytag.go new file mode 100644 index 000000000000..76b08b4e0768 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_getentitytag.go @@ -0,0 +1,46 @@ +package gatewayhostnameconfiguration + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GatewayHostnameConfigurationClient) GetEntityTag(ctx context.Context, id HostnameConfigurationId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_listbyservice.go new file mode 100644 index 000000000000..6842b2c14d30 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_listbyservice.go @@ -0,0 +1,125 @@ +package gatewayhostnameconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GatewayHostnameConfigurationContract +} + +type ListByServiceCompleteResult struct { + Items []GatewayHostnameConfigurationContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c GatewayHostnameConfigurationClient) ListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/hostnameConfigurations", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GatewayHostnameConfigurationContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c GatewayHostnameConfigurationClient) ListByServiceComplete(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GatewayHostnameConfigurationContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GatewayHostnameConfigurationClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id GatewayId, options ListByServiceOperationOptions, predicate GatewayHostnameConfigurationContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]GatewayHostnameConfigurationContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/model_gatewayhostnameconfigurationcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/model_gatewayhostnameconfigurationcontract.go new file mode 100644 index 000000000000..12edab4f7388 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/model_gatewayhostnameconfigurationcontract.go @@ -0,0 +1,11 @@ +package gatewayhostnameconfiguration + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayHostnameConfigurationContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *GatewayHostnameConfigurationContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/model_gatewayhostnameconfigurationcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/model_gatewayhostnameconfigurationcontractproperties.go new file mode 100644 index 000000000000..b65ba16ec44f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/model_gatewayhostnameconfigurationcontractproperties.go @@ -0,0 +1,13 @@ +package gatewayhostnameconfiguration + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayHostnameConfigurationContractProperties struct { + CertificateId *string `json:"certificateId,omitempty"` + HTTP2Enabled *bool `json:"http2Enabled,omitempty"` + Hostname *string `json:"hostname,omitempty"` + NegotiateClientCertificate *bool `json:"negotiateClientCertificate,omitempty"` + Tls10Enabled *bool `json:"tls10Enabled,omitempty"` + Tls11Enabled *bool `json:"tls11Enabled,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/predicates.go new file mode 100644 index 000000000000..737fbb773b49 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/predicates.go @@ -0,0 +1,27 @@ +package gatewayhostnameconfiguration + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayHostnameConfigurationContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p GatewayHostnameConfigurationContractOperationPredicate) Matches(input GatewayHostnameConfigurationContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/version.go new file mode 100644 index 000000000000..a0b9f9363dad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/version.go @@ -0,0 +1,12 @@ +package gatewayhostnameconfiguration + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/gatewayhostnameconfiguration/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/README.md new file mode 100644 index 000000000000..089e16b77d51 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group` Documentation + +The `group` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group" +``` + + +### Client Initialization + +```go +client := group.NewGroupClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `GroupClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := group.NewGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "groupIdValue") + +payload := group.GroupCreateParameters{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, group.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GroupClient.Delete` + +```go +ctx := context.TODO() +id := group.NewGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "groupIdValue") + +read, err := client.Delete(ctx, id, group.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GroupClient.Get` + +```go +ctx := context.TODO() +id := group.NewGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "groupIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GroupClient.GetEntityTag` + +```go +ctx := context.TODO() +id := group.NewGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "groupIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GroupClient.ListByService` + +```go +ctx := context.TODO() +id := group.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, group.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, group.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `GroupClient.Update` + +```go +ctx := context.TODO() +id := group.NewGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "groupIdValue") + +payload := group.GroupUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload, group.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/client.go new file mode 100644 index 000000000000..0301e35f4e8f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/client.go @@ -0,0 +1,26 @@ +package group + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupClient struct { + Client *resourcemanager.Client +} + +func NewGroupClientWithBaseURI(sdkApi sdkEnv.Api) (*GroupClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "group", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GroupClient: %+v", err) + } + + return &GroupClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/constants.go new file mode 100644 index 000000000000..1cda5dadcaf7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/constants.go @@ -0,0 +1,54 @@ +package group + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupType string + +const ( + GroupTypeCustom GroupType = "custom" + GroupTypeExternal GroupType = "external" + GroupTypeSystem GroupType = "system" +) + +func PossibleValuesForGroupType() []string { + return []string{ + string(GroupTypeCustom), + string(GroupTypeExternal), + string(GroupTypeSystem), + } +} + +func (s *GroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseGroupType(input string) (*GroupType, error) { + vals := map[string]GroupType{ + "custom": GroupTypeCustom, + "external": GroupTypeExternal, + "system": GroupTypeSystem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GroupType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/id_group.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/id_group.go new file mode 100644 index 000000000000..1cb69ca64b1c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/id_group.go @@ -0,0 +1,140 @@ +package group + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = GroupId{} + +// GroupId is a struct representing the Resource ID for a Group +type GroupId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + GroupId string +} + +// NewGroupID returns a new GroupId struct +func NewGroupID(subscriptionId string, resourceGroupName string, serviceName string, groupId string) GroupId { + return GroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + GroupId: groupId, + } +} + +// ParseGroupID parses 'input' into a GroupId +func ParseGroupID(input string) (*GroupId, error) { + parser := resourceids.NewParserFromResourceIdType(GroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + } + + return &id, nil +} + +// ParseGroupIDInsensitively parses 'input' case-insensitively into a GroupId +// note: this method should only be used for API response data and not user input +func ParseGroupIDInsensitively(input string) (*GroupId, error) { + parser := resourceids.NewParserFromResourceIdType(GroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + } + + return &id, nil +} + +// ValidateGroupID checks that 'input' can be parsed as a Group ID +func ValidateGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Group ID +func (id GroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/groups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.GroupId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Group ID +func (id GroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticGroups", "groups", "groups"), + resourceids.UserSpecifiedSegment("groupId", "groupIdValue"), + } +} + +// String returns a human-readable description of this Group ID +func (id GroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Group: %q", id.GroupId), + } + return fmt.Sprintf("Group (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/id_service.go new file mode 100644 index 000000000000..916e4cfce48b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/id_service.go @@ -0,0 +1,127 @@ +package group + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_createorupdate.go new file mode 100644 index 000000000000..c7c3873d667c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_createorupdate.go @@ -0,0 +1,85 @@ +package group + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GroupContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c GroupClient) CreateOrUpdate(ctx context.Context, id GroupId, input GroupCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_delete.go new file mode 100644 index 000000000000..8bd332e45a2d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_delete.go @@ -0,0 +1,76 @@ +package group + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c GroupClient) Delete(ctx context.Context, id GroupId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_get.go new file mode 100644 index 000000000000..4dbbc0759e21 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_get.go @@ -0,0 +1,51 @@ +package group + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GroupContract +} + +// Get ... +func (c GroupClient) Get(ctx context.Context, id GroupId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_getentitytag.go new file mode 100644 index 000000000000..e6ee5a9ba2d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_getentitytag.go @@ -0,0 +1,46 @@ +package group + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GroupClient) GetEntityTag(ctx context.Context, id GroupId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_listbyservice.go new file mode 100644 index 000000000000..080778877db1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_listbyservice.go @@ -0,0 +1,125 @@ +package group + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GroupContract +} + +type ListByServiceCompleteResult struct { + Items []GroupContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c GroupClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/groups", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GroupContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c GroupClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GroupContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GroupClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate GroupContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]GroupContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_update.go new file mode 100644 index 000000000000..8ef4191a0f25 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/method_update.go @@ -0,0 +1,84 @@ +package group + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GroupContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c GroupClient) Update(ctx context.Context, id GroupId, input GroupUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcontract.go new file mode 100644 index 000000000000..fe07f849a1ec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcontract.go @@ -0,0 +1,11 @@ +package group + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *GroupContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcontractproperties.go new file mode 100644 index 000000000000..ed0d54f3d690 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcontractproperties.go @@ -0,0 +1,12 @@ +package group + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupContractProperties struct { + BuiltIn *bool `json:"builtIn,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName string `json:"displayName"` + ExternalId *string `json:"externalId,omitempty"` + Type *GroupType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcreateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcreateparameters.go new file mode 100644 index 000000000000..74c0d6cdd976 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcreateparameters.go @@ -0,0 +1,8 @@ +package group + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupCreateParameters struct { + Properties *GroupCreateParametersProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcreateparametersproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcreateparametersproperties.go new file mode 100644 index 000000000000..8cb28930b11e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupcreateparametersproperties.go @@ -0,0 +1,11 @@ +package group + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupCreateParametersProperties struct { + Description *string `json:"description,omitempty"` + DisplayName string `json:"displayName"` + ExternalId *string `json:"externalId,omitempty"` + Type *GroupType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupupdateparameters.go new file mode 100644 index 000000000000..e9ba5ed65cc0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupupdateparameters.go @@ -0,0 +1,8 @@ +package group + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupUpdateParameters struct { + Properties *GroupUpdateParametersProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupupdateparametersproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupupdateparametersproperties.go new file mode 100644 index 000000000000..c9a758948ce5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/model_groupupdateparametersproperties.go @@ -0,0 +1,11 @@ +package group + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupUpdateParametersProperties struct { + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + ExternalId *string `json:"externalId,omitempty"` + Type *GroupType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/predicates.go new file mode 100644 index 000000000000..c6031629295c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/predicates.go @@ -0,0 +1,27 @@ +package group + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p GroupContractOperationPredicate) Matches(input GroupContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/version.go new file mode 100644 index 000000000000..1001f695b0bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group/version.go @@ -0,0 +1,12 @@ +package group + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/group/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/README.md new file mode 100644 index 000000000000..76e68e19319e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/README.md @@ -0,0 +1,85 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser` Documentation + +The `groupuser` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser" +``` + + +### Client Initialization + +```go +client := groupuser.NewGroupUserClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `GroupUserClient.CheckEntityExists` + +```go +ctx := context.TODO() +id := groupuser.NewGroupUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "groupIdValue", "userIdValue") + +read, err := client.CheckEntityExists(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GroupUserClient.Create` + +```go +ctx := context.TODO() +id := groupuser.NewGroupUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "groupIdValue", "userIdValue") + +read, err := client.Create(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GroupUserClient.Delete` + +```go +ctx := context.TODO() +id := groupuser.NewGroupUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "groupIdValue", "userIdValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GroupUserClient.List` + +```go +ctx := context.TODO() +id := groupuser.NewGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "groupIdValue") + +// alternatively `client.List(ctx, id, groupuser.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, groupuser.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/client.go new file mode 100644 index 000000000000..7a2d9304c738 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/client.go @@ -0,0 +1,26 @@ +package groupuser + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupUserClient struct { + Client *resourcemanager.Client +} + +func NewGroupUserClientWithBaseURI(sdkApi sdkEnv.Api) (*GroupUserClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "groupuser", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GroupUserClient: %+v", err) + } + + return &GroupUserClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/constants.go new file mode 100644 index 000000000000..520579fefd7a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/constants.go @@ -0,0 +1,101 @@ +package groupuser + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupType string + +const ( + GroupTypeCustom GroupType = "custom" + GroupTypeExternal GroupType = "external" + GroupTypeSystem GroupType = "system" +) + +func PossibleValuesForGroupType() []string { + return []string{ + string(GroupTypeCustom), + string(GroupTypeExternal), + string(GroupTypeSystem), + } +} + +func (s *GroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseGroupType(input string) (*GroupType, error) { + vals := map[string]GroupType{ + "custom": GroupTypeCustom, + "external": GroupTypeExternal, + "system": GroupTypeSystem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GroupType(input) + return &out, nil +} + +type UserState string + +const ( + UserStateActive UserState = "active" + UserStateBlocked UserState = "blocked" + UserStateDeleted UserState = "deleted" + UserStatePending UserState = "pending" +) + +func PossibleValuesForUserState() []string { + return []string{ + string(UserStateActive), + string(UserStateBlocked), + string(UserStateDeleted), + string(UserStatePending), + } +} + +func (s *UserState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUserState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseUserState(input string) (*UserState, error) { + vals := map[string]UserState{ + "active": UserStateActive, + "blocked": UserStateBlocked, + "deleted": UserStateDeleted, + "pending": UserStatePending, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UserState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/id_group.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/id_group.go new file mode 100644 index 000000000000..9d328f9f0263 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/id_group.go @@ -0,0 +1,140 @@ +package groupuser + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = GroupId{} + +// GroupId is a struct representing the Resource ID for a Group +type GroupId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + GroupId string +} + +// NewGroupID returns a new GroupId struct +func NewGroupID(subscriptionId string, resourceGroupName string, serviceName string, groupId string) GroupId { + return GroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + GroupId: groupId, + } +} + +// ParseGroupID parses 'input' into a GroupId +func ParseGroupID(input string) (*GroupId, error) { + parser := resourceids.NewParserFromResourceIdType(GroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + } + + return &id, nil +} + +// ParseGroupIDInsensitively parses 'input' case-insensitively into a GroupId +// note: this method should only be used for API response data and not user input +func ParseGroupIDInsensitively(input string) (*GroupId, error) { + parser := resourceids.NewParserFromResourceIdType(GroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + } + + return &id, nil +} + +// ValidateGroupID checks that 'input' can be parsed as a Group ID +func ValidateGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Group ID +func (id GroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/groups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.GroupId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Group ID +func (id GroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticGroups", "groups", "groups"), + resourceids.UserSpecifiedSegment("groupId", "groupIdValue"), + } +} + +// String returns a human-readable description of this Group ID +func (id GroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Group: %q", id.GroupId), + } + return fmt.Sprintf("Group (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/id_groupuser.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/id_groupuser.go new file mode 100644 index 000000000000..70947c02de3e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/id_groupuser.go @@ -0,0 +1,153 @@ +package groupuser + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = GroupUserId{} + +// GroupUserId is a struct representing the Resource ID for a Group User +type GroupUserId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + GroupId string + UserId string +} + +// NewGroupUserID returns a new GroupUserId struct +func NewGroupUserID(subscriptionId string, resourceGroupName string, serviceName string, groupId string, userId string) GroupUserId { + return GroupUserId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + GroupId: groupId, + UserId: userId, + } +} + +// ParseGroupUserID parses 'input' into a GroupUserId +func ParseGroupUserID(input string) (*GroupUserId, error) { + parser := resourceids.NewParserFromResourceIdType(GroupUserId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GroupUserId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + } + + if id.UserId, ok = parsed.Parsed["userId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + } + + return &id, nil +} + +// ParseGroupUserIDInsensitively parses 'input' case-insensitively into a GroupUserId +// note: this method should only be used for API response data and not user input +func ParseGroupUserIDInsensitively(input string) (*GroupUserId, error) { + parser := resourceids.NewParserFromResourceIdType(GroupUserId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GroupUserId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + } + + if id.UserId, ok = parsed.Parsed["userId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + } + + return &id, nil +} + +// ValidateGroupUserID checks that 'input' can be parsed as a Group User ID +func ValidateGroupUserID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseGroupUserID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Group User ID +func (id GroupUserId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/groups/%s/users/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.GroupId, id.UserId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Group User ID +func (id GroupUserId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticGroups", "groups", "groups"), + resourceids.UserSpecifiedSegment("groupId", "groupIdValue"), + resourceids.StaticSegment("staticUsers", "users", "users"), + resourceids.UserSpecifiedSegment("userId", "userIdValue"), + } +} + +// String returns a human-readable description of this Group User ID +func (id GroupUserId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Group: %q", id.GroupId), + fmt.Sprintf("User: %q", id.UserId), + } + return fmt.Sprintf("Group User (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_checkentityexists.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_checkentityexists.go new file mode 100644 index 000000000000..ecf5ac1f37b4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_checkentityexists.go @@ -0,0 +1,46 @@ +package groupuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckEntityExistsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CheckEntityExists ... +func (c GroupUserClient) CheckEntityExists(ctx context.Context, id GroupUserId) (result CheckEntityExistsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_create.go new file mode 100644 index 000000000000..b13b301f4038 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_create.go @@ -0,0 +1,52 @@ +package groupuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *UserContract +} + +// Create ... +func (c GroupUserClient) Create(ctx context.Context, id GroupUserId) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_delete.go new file mode 100644 index 000000000000..e8513f361200 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_delete.go @@ -0,0 +1,47 @@ +package groupuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c GroupUserClient) Delete(ctx context.Context, id GroupUserId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_list.go new file mode 100644 index 000000000000..0f87bb365b1f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/method_list.go @@ -0,0 +1,125 @@ +package groupuser + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]UserContract +} + +type ListCompleteResult struct { + Items []UserContract +} + +type ListOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// List ... +func (c GroupUserClient) List(ctx context.Context, id GroupId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/users", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]UserContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c GroupUserClient) ListComplete(ctx context.Context, id GroupId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, UserContractOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GroupUserClient) ListCompleteMatchingPredicate(ctx context.Context, id GroupId, options ListOperationOptions, predicate UserContractOperationPredicate) (result ListCompleteResult, err error) { + items := make([]UserContract, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_groupcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_groupcontractproperties.go new file mode 100644 index 000000000000..a734b3f8f74c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_groupcontractproperties.go @@ -0,0 +1,12 @@ +package groupuser + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupContractProperties struct { + BuiltIn *bool `json:"builtIn,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName string `json:"displayName"` + ExternalId *string `json:"externalId,omitempty"` + Type *GroupType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_usercontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_usercontract.go new file mode 100644 index 000000000000..1da87de7aeb3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_usercontract.go @@ -0,0 +1,11 @@ +package groupuser + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *UserContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_usercontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_usercontractproperties.go new file mode 100644 index 000000000000..11eac96a912f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_usercontractproperties.go @@ -0,0 +1,33 @@ +package groupuser + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserContractProperties struct { + Email *string `json:"email,omitempty"` + FirstName *string `json:"firstName,omitempty"` + Groups *[]GroupContractProperties `json:"groups,omitempty"` + Identities *[]UserIdentityContract `json:"identities,omitempty"` + LastName *string `json:"lastName,omitempty"` + Note *string `json:"note,omitempty"` + RegistrationDate *string `json:"registrationDate,omitempty"` + State *UserState `json:"state,omitempty"` +} + +func (o *UserContractProperties) GetRegistrationDateAsTime() (*time.Time, error) { + if o.RegistrationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.RegistrationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *UserContractProperties) SetRegistrationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.RegistrationDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_useridentitycontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_useridentitycontract.go new file mode 100644 index 000000000000..fb1d5a656ad5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/model_useridentitycontract.go @@ -0,0 +1,9 @@ +package groupuser + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserIdentityContract struct { + Id *string `json:"id,omitempty"` + Provider *string `json:"provider,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/predicates.go new file mode 100644 index 000000000000..c2691a6325db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/predicates.go @@ -0,0 +1,27 @@ +package groupuser + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p UserContractOperationPredicate) Matches(input UserContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/version.go new file mode 100644 index 000000000000..d4942fd1d7ed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser/version.go @@ -0,0 +1,12 @@ +package groupuser + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/groupuser/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/README.md new file mode 100644 index 000000000000..13420e5f0308 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/README.md @@ -0,0 +1,143 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider` Documentation + +The `identityprovider` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider" +``` + + +### Client Initialization + +```go +client := identityprovider.NewIdentityProviderClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `IdentityProviderClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := identityprovider.NewIdentityProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "aad") + +payload := identityprovider.IdentityProviderCreateContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, identityprovider.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IdentityProviderClient.Delete` + +```go +ctx := context.TODO() +id := identityprovider.NewIdentityProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "aad") + +read, err := client.Delete(ctx, id, identityprovider.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IdentityProviderClient.Get` + +```go +ctx := context.TODO() +id := identityprovider.NewIdentityProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "aad") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IdentityProviderClient.GetEntityTag` + +```go +ctx := context.TODO() +id := identityprovider.NewIdentityProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "aad") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IdentityProviderClient.ListByService` + +```go +ctx := context.TODO() +id := identityprovider.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id)` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `IdentityProviderClient.ListSecrets` + +```go +ctx := context.TODO() +id := identityprovider.NewIdentityProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "aad") + +read, err := client.ListSecrets(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IdentityProviderClient.Update` + +```go +ctx := context.TODO() +id := identityprovider.NewIdentityProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "aad") + +payload := identityprovider.IdentityProviderUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload, identityprovider.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/client.go new file mode 100644 index 000000000000..ba2ed8bbee1b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/client.go @@ -0,0 +1,26 @@ +package identityprovider + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IdentityProviderClient struct { + Client *resourcemanager.Client +} + +func NewIdentityProviderClientWithBaseURI(sdkApi sdkEnv.Api) (*IdentityProviderClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "identityprovider", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating IdentityProviderClient: %+v", err) + } + + return &IdentityProviderClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/constants.go new file mode 100644 index 000000000000..d96fcd032534 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/constants.go @@ -0,0 +1,63 @@ +package identityprovider + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IdentityProviderType string + +const ( + IdentityProviderTypeAad IdentityProviderType = "aad" + IdentityProviderTypeAadBTwoC IdentityProviderType = "aadB2C" + IdentityProviderTypeFacebook IdentityProviderType = "facebook" + IdentityProviderTypeGoogle IdentityProviderType = "google" + IdentityProviderTypeMicrosoft IdentityProviderType = "microsoft" + IdentityProviderTypeTwitter IdentityProviderType = "twitter" +) + +func PossibleValuesForIdentityProviderType() []string { + return []string{ + string(IdentityProviderTypeAad), + string(IdentityProviderTypeAadBTwoC), + string(IdentityProviderTypeFacebook), + string(IdentityProviderTypeGoogle), + string(IdentityProviderTypeMicrosoft), + string(IdentityProviderTypeTwitter), + } +} + +func (s *IdentityProviderType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIdentityProviderType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIdentityProviderType(input string) (*IdentityProviderType, error) { + vals := map[string]IdentityProviderType{ + "aad": IdentityProviderTypeAad, + "aadb2c": IdentityProviderTypeAadBTwoC, + "facebook": IdentityProviderTypeFacebook, + "google": IdentityProviderTypeGoogle, + "microsoft": IdentityProviderTypeMicrosoft, + "twitter": IdentityProviderTypeTwitter, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IdentityProviderType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/id_identityprovider.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/id_identityprovider.go new file mode 100644 index 000000000000..b31fc9697f39 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/id_identityprovider.go @@ -0,0 +1,156 @@ +package identityprovider + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = IdentityProviderId{} + +// IdentityProviderId is a struct representing the Resource ID for a Identity Provider +type IdentityProviderId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + IdentityProviderName IdentityProviderType +} + +// NewIdentityProviderID returns a new IdentityProviderId struct +func NewIdentityProviderID(subscriptionId string, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) IdentityProviderId { + return IdentityProviderId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + IdentityProviderName: identityProviderName, + } +} + +// ParseIdentityProviderID parses 'input' into a IdentityProviderId +func ParseIdentityProviderID(input string) (*IdentityProviderId, error) { + parser := resourceids.NewParserFromResourceIdType(IdentityProviderId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IdentityProviderId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if v, ok := parsed.Parsed["identityProviderName"]; true { + if !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "identityProviderName", *parsed) + } + + identityProviderName, err := parseIdentityProviderType(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.IdentityProviderName = *identityProviderName + } + + return &id, nil +} + +// ParseIdentityProviderIDInsensitively parses 'input' case-insensitively into a IdentityProviderId +// note: this method should only be used for API response data and not user input +func ParseIdentityProviderIDInsensitively(input string) (*IdentityProviderId, error) { + parser := resourceids.NewParserFromResourceIdType(IdentityProviderId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IdentityProviderId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if v, ok := parsed.Parsed["identityProviderName"]; true { + if !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "identityProviderName", *parsed) + } + + identityProviderName, err := parseIdentityProviderType(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.IdentityProviderName = *identityProviderName + } + + return &id, nil +} + +// ValidateIdentityProviderID checks that 'input' can be parsed as a Identity Provider ID +func ValidateIdentityProviderID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseIdentityProviderID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Identity Provider ID +func (id IdentityProviderId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/identityProviders/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, string(id.IdentityProviderName)) +} + +// Segments returns a slice of Resource ID Segments which comprise this Identity Provider ID +func (id IdentityProviderId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticIdentityProviders", "identityProviders", "identityProviders"), + resourceids.ConstantSegment("identityProviderName", PossibleValuesForIdentityProviderType(), "aad"), + } +} + +// String returns a human-readable description of this Identity Provider ID +func (id IdentityProviderId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Identity Provider Name: %q", string(id.IdentityProviderName)), + } + return fmt.Sprintf("Identity Provider (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/id_service.go new file mode 100644 index 000000000000..89ca80d7df09 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/id_service.go @@ -0,0 +1,127 @@ +package identityprovider + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_createorupdate.go new file mode 100644 index 000000000000..7e7257ff801d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_createorupdate.go @@ -0,0 +1,85 @@ +package identityprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IdentityProviderContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c IdentityProviderClient) CreateOrUpdate(ctx context.Context, id IdentityProviderId, input IdentityProviderCreateContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_delete.go new file mode 100644 index 000000000000..ff4f9cee7c44 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_delete.go @@ -0,0 +1,76 @@ +package identityprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c IdentityProviderClient) Delete(ctx context.Context, id IdentityProviderId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_get.go new file mode 100644 index 000000000000..3ea0d912b931 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_get.go @@ -0,0 +1,51 @@ +package identityprovider + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IdentityProviderContract +} + +// Get ... +func (c IdentityProviderClient) Get(ctx context.Context, id IdentityProviderId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_getentitytag.go new file mode 100644 index 000000000000..626d199ac1f6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_getentitytag.go @@ -0,0 +1,46 @@ +package identityprovider + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c IdentityProviderClient) GetEntityTag(ctx context.Context, id IdentityProviderId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_listbyservice.go new file mode 100644 index 000000000000..881b72000166 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_listbyservice.go @@ -0,0 +1,89 @@ +package identityprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]IdentityProviderContract +} + +type ListByServiceCompleteResult struct { + Items []IdentityProviderContract +} + +// ListByService ... +func (c IdentityProviderClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/identityProviders", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]IdentityProviderContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c IdentityProviderClient) ListByServiceComplete(ctx context.Context, id ServiceId) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, IdentityProviderContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c IdentityProviderClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate IdentityProviderContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]IdentityProviderContract, 0) + + resp, err := c.ListByService(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_listsecrets.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_listsecrets.go new file mode 100644 index 000000000000..bf808b634344 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_listsecrets.go @@ -0,0 +1,52 @@ +package identityprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ClientSecretContract +} + +// ListSecrets ... +func (c IdentityProviderClient) ListSecrets(ctx context.Context, id IdentityProviderId) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_update.go new file mode 100644 index 000000000000..9ac8eaebfa48 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/method_update.go @@ -0,0 +1,84 @@ +package identityprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IdentityProviderContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c IdentityProviderClient) Update(ctx context.Context, id IdentityProviderId, input IdentityProviderUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_clientsecretcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_clientsecretcontract.go new file mode 100644 index 000000000000..8ab3fa47bc02 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_clientsecretcontract.go @@ -0,0 +1,8 @@ +package identityprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClientSecretContract struct { + ClientSecret *string `json:"clientSecret,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercontract.go new file mode 100644 index 000000000000..8191ccfc8b7d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercontract.go @@ -0,0 +1,11 @@ +package identityprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IdentityProviderContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *IdentityProviderContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercontractproperties.go new file mode 100644 index 000000000000..3a2c6c9ac045 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercontractproperties.go @@ -0,0 +1,17 @@ +package identityprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IdentityProviderContractProperties struct { + AllowedTenants *[]string `json:"allowedTenants,omitempty"` + Authority *string `json:"authority,omitempty"` + ClientId string `json:"clientId"` + ClientSecret *string `json:"clientSecret,omitempty"` + PasswordResetPolicyName *string `json:"passwordResetPolicyName,omitempty"` + ProfileEditingPolicyName *string `json:"profileEditingPolicyName,omitempty"` + SigninPolicyName *string `json:"signinPolicyName,omitempty"` + SigninTenant *string `json:"signinTenant,omitempty"` + SignupPolicyName *string `json:"signupPolicyName,omitempty"` + Type *IdentityProviderType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercreatecontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercreatecontract.go new file mode 100644 index 000000000000..c0a6875caa4e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercreatecontract.go @@ -0,0 +1,11 @@ +package identityprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IdentityProviderCreateContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *IdentityProviderCreateContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercreatecontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercreatecontractproperties.go new file mode 100644 index 000000000000..909f0c8f6394 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityprovidercreatecontractproperties.go @@ -0,0 +1,17 @@ +package identityprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IdentityProviderCreateContractProperties struct { + AllowedTenants *[]string `json:"allowedTenants,omitempty"` + Authority *string `json:"authority,omitempty"` + ClientId string `json:"clientId"` + ClientSecret string `json:"clientSecret"` + PasswordResetPolicyName *string `json:"passwordResetPolicyName,omitempty"` + ProfileEditingPolicyName *string `json:"profileEditingPolicyName,omitempty"` + SigninPolicyName *string `json:"signinPolicyName,omitempty"` + SigninTenant *string `json:"signinTenant,omitempty"` + SignupPolicyName *string `json:"signupPolicyName,omitempty"` + Type *IdentityProviderType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityproviderupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityproviderupdateparameters.go new file mode 100644 index 000000000000..d7e0a9d45489 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityproviderupdateparameters.go @@ -0,0 +1,8 @@ +package identityprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IdentityProviderUpdateParameters struct { + Properties *IdentityProviderUpdateProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityproviderupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityproviderupdateproperties.go new file mode 100644 index 000000000000..712ea2330987 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/model_identityproviderupdateproperties.go @@ -0,0 +1,17 @@ +package identityprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IdentityProviderUpdateProperties struct { + AllowedTenants *[]string `json:"allowedTenants,omitempty"` + Authority *string `json:"authority,omitempty"` + ClientId *string `json:"clientId,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` + PasswordResetPolicyName *string `json:"passwordResetPolicyName,omitempty"` + ProfileEditingPolicyName *string `json:"profileEditingPolicyName,omitempty"` + SigninPolicyName *string `json:"signinPolicyName,omitempty"` + SigninTenant *string `json:"signinTenant,omitempty"` + SignupPolicyName *string `json:"signupPolicyName,omitempty"` + Type *IdentityProviderType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/predicates.go new file mode 100644 index 000000000000..106538ef5e6f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/predicates.go @@ -0,0 +1,27 @@ +package identityprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IdentityProviderContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p IdentityProviderContractOperationPredicate) Matches(input IdentityProviderContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/version.go new file mode 100644 index 000000000000..9edcb8c2c336 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider/version.go @@ -0,0 +1,12 @@ +package identityprovider + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/identityprovider/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/README.md new file mode 100644 index 000000000000..525e5b6800f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger` Documentation + +The `logger` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger" +``` + + +### Client Initialization + +```go +client := logger.NewLoggerClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `LoggerClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := logger.NewLoggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "loggerIdValue") + +payload := logger.LoggerContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, logger.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `LoggerClient.Delete` + +```go +ctx := context.TODO() +id := logger.NewLoggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "loggerIdValue") + +read, err := client.Delete(ctx, id, logger.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `LoggerClient.Get` + +```go +ctx := context.TODO() +id := logger.NewLoggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "loggerIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `LoggerClient.GetEntityTag` + +```go +ctx := context.TODO() +id := logger.NewLoggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "loggerIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `LoggerClient.ListByService` + +```go +ctx := context.TODO() +id := logger.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, logger.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, logger.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `LoggerClient.Update` + +```go +ctx := context.TODO() +id := logger.NewLoggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "loggerIdValue") + +payload := logger.LoggerUpdateContract{ + // ... +} + + +read, err := client.Update(ctx, id, payload, logger.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/client.go new file mode 100644 index 000000000000..c7b58012a846 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/client.go @@ -0,0 +1,26 @@ +package logger + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoggerClient struct { + Client *resourcemanager.Client +} + +func NewLoggerClientWithBaseURI(sdkApi sdkEnv.Api) (*LoggerClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "logger", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating LoggerClient: %+v", err) + } + + return &LoggerClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/constants.go new file mode 100644 index 000000000000..0aa7cb68a3e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/constants.go @@ -0,0 +1,54 @@ +package logger + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoggerType string + +const ( + LoggerTypeApplicationInsights LoggerType = "applicationInsights" + LoggerTypeAzureEventHub LoggerType = "azureEventHub" + LoggerTypeAzureMonitor LoggerType = "azureMonitor" +) + +func PossibleValuesForLoggerType() []string { + return []string{ + string(LoggerTypeApplicationInsights), + string(LoggerTypeAzureEventHub), + string(LoggerTypeAzureMonitor), + } +} + +func (s *LoggerType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLoggerType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLoggerType(input string) (*LoggerType, error) { + vals := map[string]LoggerType{ + "applicationinsights": LoggerTypeApplicationInsights, + "azureeventhub": LoggerTypeAzureEventHub, + "azuremonitor": LoggerTypeAzureMonitor, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LoggerType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/id_logger.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/id_logger.go new file mode 100644 index 000000000000..ee7f985a1917 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/id_logger.go @@ -0,0 +1,140 @@ +package logger + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = LoggerId{} + +// LoggerId is a struct representing the Resource ID for a Logger +type LoggerId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + LoggerId string +} + +// NewLoggerID returns a new LoggerId struct +func NewLoggerID(subscriptionId string, resourceGroupName string, serviceName string, loggerId string) LoggerId { + return LoggerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + LoggerId: loggerId, + } +} + +// ParseLoggerID parses 'input' into a LoggerId +func ParseLoggerID(input string) (*LoggerId, error) { + parser := resourceids.NewParserFromResourceIdType(LoggerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LoggerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.LoggerId, ok = parsed.Parsed["loggerId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "loggerId", *parsed) + } + + return &id, nil +} + +// ParseLoggerIDInsensitively parses 'input' case-insensitively into a LoggerId +// note: this method should only be used for API response data and not user input +func ParseLoggerIDInsensitively(input string) (*LoggerId, error) { + parser := resourceids.NewParserFromResourceIdType(LoggerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LoggerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.LoggerId, ok = parsed.Parsed["loggerId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "loggerId", *parsed) + } + + return &id, nil +} + +// ValidateLoggerID checks that 'input' can be parsed as a Logger ID +func ValidateLoggerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLoggerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Logger ID +func (id LoggerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/loggers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.LoggerId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Logger ID +func (id LoggerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticLoggers", "loggers", "loggers"), + resourceids.UserSpecifiedSegment("loggerId", "loggerIdValue"), + } +} + +// String returns a human-readable description of this Logger ID +func (id LoggerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Logger: %q", id.LoggerId), + } + return fmt.Sprintf("Logger (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/id_service.go new file mode 100644 index 000000000000..5807ecae3aa9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/id_service.go @@ -0,0 +1,127 @@ +package logger + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_createorupdate.go new file mode 100644 index 000000000000..5afa3c7881e0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_createorupdate.go @@ -0,0 +1,85 @@ +package logger + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *LoggerContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c LoggerClient) CreateOrUpdate(ctx context.Context, id LoggerId, input LoggerContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_delete.go new file mode 100644 index 000000000000..9a3b1b42ad92 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_delete.go @@ -0,0 +1,76 @@ +package logger + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c LoggerClient) Delete(ctx context.Context, id LoggerId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_get.go new file mode 100644 index 000000000000..a755ecf82639 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_get.go @@ -0,0 +1,51 @@ +package logger + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *LoggerContract +} + +// Get ... +func (c LoggerClient) Get(ctx context.Context, id LoggerId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_getentitytag.go new file mode 100644 index 000000000000..b65f6ac22bdb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_getentitytag.go @@ -0,0 +1,46 @@ +package logger + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c LoggerClient) GetEntityTag(ctx context.Context, id LoggerId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_listbyservice.go new file mode 100644 index 000000000000..6049c405eb85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_listbyservice.go @@ -0,0 +1,125 @@ +package logger + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]LoggerContract +} + +type ListByServiceCompleteResult struct { + Items []LoggerContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c LoggerClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/loggers", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]LoggerContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c LoggerClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, LoggerContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c LoggerClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate LoggerContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]LoggerContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_update.go new file mode 100644 index 000000000000..f7245ad94049 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/method_update.go @@ -0,0 +1,84 @@ +package logger + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *LoggerContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c LoggerClient) Update(ctx context.Context, id LoggerId, input LoggerUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggercontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggercontract.go new file mode 100644 index 000000000000..972cc05b227c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggercontract.go @@ -0,0 +1,11 @@ +package logger + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoggerContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *LoggerContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggercontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggercontractproperties.go new file mode 100644 index 000000000000..d70cd7607e35 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggercontractproperties.go @@ -0,0 +1,12 @@ +package logger + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoggerContractProperties struct { + Credentials *map[string]string `json:"credentials,omitempty"` + Description *string `json:"description,omitempty"` + IsBuffered *bool `json:"isBuffered,omitempty"` + LoggerType LoggerType `json:"loggerType"` + ResourceId *string `json:"resourceId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggerupdatecontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggerupdatecontract.go new file mode 100644 index 000000000000..35373cca5cf2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggerupdatecontract.go @@ -0,0 +1,8 @@ +package logger + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoggerUpdateContract struct { + Properties *LoggerUpdateParameters `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggerupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggerupdateparameters.go new file mode 100644 index 000000000000..4a4958deaf5c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/model_loggerupdateparameters.go @@ -0,0 +1,11 @@ +package logger + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoggerUpdateParameters struct { + Credentials *map[string]string `json:"credentials,omitempty"` + Description *string `json:"description,omitempty"` + IsBuffered *bool `json:"isBuffered,omitempty"` + LoggerType *LoggerType `json:"loggerType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/predicates.go new file mode 100644 index 000000000000..9dfff89de122 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/predicates.go @@ -0,0 +1,27 @@ +package logger + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoggerContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p LoggerContractOperationPredicate) Matches(input LoggerContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/version.go new file mode 100644 index 000000000000..48cdae21fcc8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger/version.go @@ -0,0 +1,12 @@ +package logger + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/logger/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/README.md new file mode 100644 index 000000000000..27327d4b6b0d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/README.md @@ -0,0 +1,147 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue` Documentation + +The `namedvalue` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue" +``` + + +### Client Initialization + +```go +client := namedvalue.NewNamedValueClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NamedValueClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := namedvalue.NewNamedValueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "namedValueIdValue") + +payload := namedvalue.NamedValueCreateContract{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload, namedvalue.DefaultCreateOrUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `NamedValueClient.Delete` + +```go +ctx := context.TODO() +id := namedvalue.NewNamedValueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "namedValueIdValue") + +read, err := client.Delete(ctx, id, namedvalue.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamedValueClient.Get` + +```go +ctx := context.TODO() +id := namedvalue.NewNamedValueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "namedValueIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamedValueClient.GetEntityTag` + +```go +ctx := context.TODO() +id := namedvalue.NewNamedValueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "namedValueIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamedValueClient.ListByService` + +```go +ctx := context.TODO() +id := namedvalue.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, namedvalue.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, namedvalue.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NamedValueClient.ListValue` + +```go +ctx := context.TODO() +id := namedvalue.NewNamedValueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "namedValueIdValue") + +read, err := client.ListValue(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamedValueClient.RefreshSecret` + +```go +ctx := context.TODO() +id := namedvalue.NewNamedValueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "namedValueIdValue") + +if err := client.RefreshSecretThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `NamedValueClient.Update` + +```go +ctx := context.TODO() +id := namedvalue.NewNamedValueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "namedValueIdValue") + +payload := namedvalue.NamedValueUpdateParameters{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload, namedvalue.DefaultUpdateOperationOptions()); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/client.go new file mode 100644 index 000000000000..9bc64e690ca9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/client.go @@ -0,0 +1,26 @@ +package namedvalue + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamedValueClient struct { + Client *resourcemanager.Client +} + +func NewNamedValueClientWithBaseURI(sdkApi sdkEnv.Api) (*NamedValueClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "namedvalue", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NamedValueClient: %+v", err) + } + + return &NamedValueClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/id_namedvalue.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/id_namedvalue.go new file mode 100644 index 000000000000..eb84d26bb30f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/id_namedvalue.go @@ -0,0 +1,140 @@ +package namedvalue + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = NamedValueId{} + +// NamedValueId is a struct representing the Resource ID for a Named Value +type NamedValueId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + NamedValueId string +} + +// NewNamedValueID returns a new NamedValueId struct +func NewNamedValueID(subscriptionId string, resourceGroupName string, serviceName string, namedValueId string) NamedValueId { + return NamedValueId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + NamedValueId: namedValueId, + } +} + +// ParseNamedValueID parses 'input' into a NamedValueId +func ParseNamedValueID(input string) (*NamedValueId, error) { + parser := resourceids.NewParserFromResourceIdType(NamedValueId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamedValueId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.NamedValueId, ok = parsed.Parsed["namedValueId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "namedValueId", *parsed) + } + + return &id, nil +} + +// ParseNamedValueIDInsensitively parses 'input' case-insensitively into a NamedValueId +// note: this method should only be used for API response data and not user input +func ParseNamedValueIDInsensitively(input string) (*NamedValueId, error) { + parser := resourceids.NewParserFromResourceIdType(NamedValueId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamedValueId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.NamedValueId, ok = parsed.Parsed["namedValueId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "namedValueId", *parsed) + } + + return &id, nil +} + +// ValidateNamedValueID checks that 'input' can be parsed as a Named Value ID +func ValidateNamedValueID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNamedValueID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Named Value ID +func (id NamedValueId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/namedValues/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.NamedValueId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Named Value ID +func (id NamedValueId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticNamedValues", "namedValues", "namedValues"), + resourceids.UserSpecifiedSegment("namedValueId", "namedValueIdValue"), + } +} + +// String returns a human-readable description of this Named Value ID +func (id NamedValueId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Named Value: %q", id.NamedValueId), + } + return fmt.Sprintf("Named Value (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/id_service.go new file mode 100644 index 000000000000..a39da071fda5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/id_service.go @@ -0,0 +1,127 @@ +package namedvalue + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_createorupdate.go new file mode 100644 index 000000000000..09c8aa0bbe53 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_createorupdate.go @@ -0,0 +1,103 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c NamedValueClient) CreateOrUpdate(ctx context.Context, id NamedValueId, input NamedValueCreateContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c NamedValueClient) CreateOrUpdateThenPoll(ctx context.Context, id NamedValueId, input NamedValueCreateContract, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_delete.go new file mode 100644 index 000000000000..82bbf62ac51b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_delete.go @@ -0,0 +1,76 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c NamedValueClient) Delete(ctx context.Context, id NamedValueId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_get.go new file mode 100644 index 000000000000..db6c7dc54e2b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_get.go @@ -0,0 +1,51 @@ +package namedvalue + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NamedValueContract +} + +// Get ... +func (c NamedValueClient) Get(ctx context.Context, id NamedValueId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_getentitytag.go new file mode 100644 index 000000000000..d292a66e0af4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_getentitytag.go @@ -0,0 +1,46 @@ +package namedvalue + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c NamedValueClient) GetEntityTag(ctx context.Context, id NamedValueId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_listbyservice.go new file mode 100644 index 000000000000..ebb1b6b4849b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_listbyservice.go @@ -0,0 +1,129 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]NamedValueContract +} + +type ListByServiceCompleteResult struct { + Items []NamedValueContract +} + +type ListByServiceOperationOptions struct { + Filter *string + IsKeyVaultRefreshFailed *bool + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.IsKeyVaultRefreshFailed != nil { + out.Append("isKeyVaultRefreshFailed", fmt.Sprintf("%v", *o.IsKeyVaultRefreshFailed)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c NamedValueClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/namedValues", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]NamedValueContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c NamedValueClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, NamedValueContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c NamedValueClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate NamedValueContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]NamedValueContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_listvalue.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_listvalue.go new file mode 100644 index 000000000000..4dbf0997989f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_listvalue.go @@ -0,0 +1,52 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListValueOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NamedValueSecretContract +} + +// ListValue ... +func (c NamedValueClient) ListValue(ctx context.Context, id NamedValueId) (result ListValueOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listValue", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_refreshsecret.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_refreshsecret.go new file mode 100644 index 000000000000..0dd3a006aecd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_refreshsecret.go @@ -0,0 +1,70 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RefreshSecretOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// RefreshSecret ... +func (c NamedValueClient) RefreshSecret(ctx context.Context, id NamedValueId) (result RefreshSecretOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/refreshSecret", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// RefreshSecretThenPoll performs RefreshSecret then polls until it's completed +func (c NamedValueClient) RefreshSecretThenPoll(ctx context.Context, id NamedValueId) error { + result, err := c.RefreshSecret(ctx, id) + if err != nil { + return fmt.Errorf("performing RefreshSecret: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RefreshSecret: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_update.go new file mode 100644 index 000000000000..83793e803c73 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/method_update.go @@ -0,0 +1,102 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c NamedValueClient) Update(ctx context.Context, id NamedValueId, input NamedValueUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c NamedValueClient) UpdateThenPoll(ctx context.Context, id NamedValueId, input NamedValueUpdateParameters, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_keyvaultcontractcreateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_keyvaultcontractcreateproperties.go new file mode 100644 index 000000000000..7c21d4ced86c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_keyvaultcontractcreateproperties.go @@ -0,0 +1,9 @@ +package namedvalue + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultContractCreateProperties struct { + IdentityClientId *string `json:"identityClientId,omitempty"` + SecretIdentifier *string `json:"secretIdentifier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_keyvaultcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_keyvaultcontractproperties.go new file mode 100644 index 000000000000..9f8d5ec6e0c6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_keyvaultcontractproperties.go @@ -0,0 +1,10 @@ +package namedvalue + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultContractProperties struct { + IdentityClientId *string `json:"identityClientId,omitempty"` + LastStatus *KeyVaultLastAccessStatusContractProperties `json:"lastStatus,omitempty"` + SecretIdentifier *string `json:"secretIdentifier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_keyvaultlastaccessstatuscontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_keyvaultlastaccessstatuscontractproperties.go new file mode 100644 index 000000000000..a27c207308cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_keyvaultlastaccessstatuscontractproperties.go @@ -0,0 +1,28 @@ +package namedvalue + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultLastAccessStatusContractProperties struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + TimeStampUtc *string `json:"timeStampUtc,omitempty"` +} + +func (o *KeyVaultLastAccessStatusContractProperties) GetTimeStampUtcAsTime() (*time.Time, error) { + if o.TimeStampUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeStampUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *KeyVaultLastAccessStatusContractProperties) SetTimeStampUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeStampUtc = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecontract.go new file mode 100644 index 000000000000..bfaa27c0bc2b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecontract.go @@ -0,0 +1,11 @@ +package namedvalue + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamedValueContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *NamedValueContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecontractproperties.go new file mode 100644 index 000000000000..e07d3d63fc51 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecontractproperties.go @@ -0,0 +1,12 @@ +package namedvalue + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamedValueContractProperties struct { + DisplayName string `json:"displayName"` + KeyVault *KeyVaultContractProperties `json:"keyVault,omitempty"` + Secret *bool `json:"secret,omitempty"` + Tags *[]string `json:"tags,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecreatecontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecreatecontract.go new file mode 100644 index 000000000000..5446f9b89857 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecreatecontract.go @@ -0,0 +1,11 @@ +package namedvalue + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamedValueCreateContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *NamedValueCreateContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecreatecontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecreatecontractproperties.go new file mode 100644 index 000000000000..2be31c2662f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluecreatecontractproperties.go @@ -0,0 +1,12 @@ +package namedvalue + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamedValueCreateContractProperties struct { + DisplayName string `json:"displayName"` + KeyVault *KeyVaultContractCreateProperties `json:"keyVault,omitempty"` + Secret *bool `json:"secret,omitempty"` + Tags *[]string `json:"tags,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluesecretcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluesecretcontract.go new file mode 100644 index 000000000000..94b2c5c2982b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvaluesecretcontract.go @@ -0,0 +1,8 @@ +package namedvalue + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamedValueSecretContract struct { + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvalueupdateparameterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvalueupdateparameterproperties.go new file mode 100644 index 000000000000..1aeaf47e26c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvalueupdateparameterproperties.go @@ -0,0 +1,12 @@ +package namedvalue + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamedValueUpdateParameterProperties struct { + DisplayName *string `json:"displayName,omitempty"` + KeyVault *KeyVaultContractCreateProperties `json:"keyVault,omitempty"` + Secret *bool `json:"secret,omitempty"` + Tags *[]string `json:"tags,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvalueupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvalueupdateparameters.go new file mode 100644 index 000000000000..1b480e40657a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/model_namedvalueupdateparameters.go @@ -0,0 +1,8 @@ +package namedvalue + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamedValueUpdateParameters struct { + Properties *NamedValueUpdateParameterProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/predicates.go new file mode 100644 index 000000000000..7bffc82f9dab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/predicates.go @@ -0,0 +1,27 @@ +package namedvalue + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamedValueContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p NamedValueContractOperationPredicate) Matches(input NamedValueContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/version.go new file mode 100644 index 000000000000..aaefa3f03e8d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue/version.go @@ -0,0 +1,12 @@ +package namedvalue + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/namedvalue/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/README.md new file mode 100644 index 000000000000..6cfc06ea19a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/README.md @@ -0,0 +1,84 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail` Documentation + +The `notificationrecipientemail` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail" +``` + + +### Client Initialization + +```go +client := notificationrecipientemail.NewNotificationRecipientEmailClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NotificationRecipientEmailClient.CheckEntityExists` + +```go +ctx := context.TODO() +id := notificationrecipientemail.NewRecipientEmailID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "AccountClosedPublisher", "recipientEmailValue") + +read, err := client.CheckEntityExists(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationRecipientEmailClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := notificationrecipientemail.NewRecipientEmailID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "AccountClosedPublisher", "recipientEmailValue") + +read, err := client.CreateOrUpdate(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationRecipientEmailClient.Delete` + +```go +ctx := context.TODO() +id := notificationrecipientemail.NewRecipientEmailID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "AccountClosedPublisher", "recipientEmailValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationRecipientEmailClient.ListByNotification` + +```go +ctx := context.TODO() +id := notificationrecipientemail.NewNotificationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "AccountClosedPublisher") + +read, err := client.ListByNotification(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/client.go new file mode 100644 index 000000000000..9975fccb8502 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/client.go @@ -0,0 +1,26 @@ +package notificationrecipientemail + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationRecipientEmailClient struct { + Client *resourcemanager.Client +} + +func NewNotificationRecipientEmailClientWithBaseURI(sdkApi sdkEnv.Api) (*NotificationRecipientEmailClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "notificationrecipientemail", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NotificationRecipientEmailClient: %+v", err) + } + + return &NotificationRecipientEmailClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/constants.go new file mode 100644 index 000000000000..85940aee54e2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/constants.go @@ -0,0 +1,66 @@ +package notificationrecipientemail + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationName string + +const ( + NotificationNameAccountClosedPublisher NotificationName = "AccountClosedPublisher" + NotificationNameBCC NotificationName = "BCC" + NotificationNameNewApplicationNotificationMessage NotificationName = "NewApplicationNotificationMessage" + NotificationNameNewIssuePublisherNotificationMessage NotificationName = "NewIssuePublisherNotificationMessage" + NotificationNamePurchasePublisherNotificationMessage NotificationName = "PurchasePublisherNotificationMessage" + NotificationNameQuotaLimitApproachingPublisherNotificationMessage NotificationName = "QuotaLimitApproachingPublisherNotificationMessage" + NotificationNameRequestPublisherNotificationMessage NotificationName = "RequestPublisherNotificationMessage" +) + +func PossibleValuesForNotificationName() []string { + return []string{ + string(NotificationNameAccountClosedPublisher), + string(NotificationNameBCC), + string(NotificationNameNewApplicationNotificationMessage), + string(NotificationNameNewIssuePublisherNotificationMessage), + string(NotificationNamePurchasePublisherNotificationMessage), + string(NotificationNameQuotaLimitApproachingPublisherNotificationMessage), + string(NotificationNameRequestPublisherNotificationMessage), + } +} + +func (s *NotificationName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNotificationName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNotificationName(input string) (*NotificationName, error) { + vals := map[string]NotificationName{ + "accountclosedpublisher": NotificationNameAccountClosedPublisher, + "bcc": NotificationNameBCC, + "newapplicationnotificationmessage": NotificationNameNewApplicationNotificationMessage, + "newissuepublishernotificationmessage": NotificationNameNewIssuePublisherNotificationMessage, + "purchasepublishernotificationmessage": NotificationNamePurchasePublisherNotificationMessage, + "quotalimitapproachingpublishernotificationmessage": NotificationNameQuotaLimitApproachingPublisherNotificationMessage, + "requestpublishernotificationmessage": NotificationNameRequestPublisherNotificationMessage, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NotificationName(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_notification.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_notification.go new file mode 100644 index 000000000000..03494ec3aece --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_notification.go @@ -0,0 +1,156 @@ +package notificationrecipientemail + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = NotificationId{} + +// NotificationId is a struct representing the Resource ID for a Notification +type NotificationId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + NotificationName NotificationName +} + +// NewNotificationID returns a new NotificationId struct +func NewNotificationID(subscriptionId string, resourceGroupName string, serviceName string, notificationName NotificationName) NotificationId { + return NotificationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + NotificationName: notificationName, + } +} + +// ParseNotificationID parses 'input' into a NotificationId +func ParseNotificationID(input string) (*NotificationId, error) { + parser := resourceids.NewParserFromResourceIdType(NotificationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NotificationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if v, ok := parsed.Parsed["notificationName"]; true { + if !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + } + + notificationName, err := parseNotificationName(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.NotificationName = *notificationName + } + + return &id, nil +} + +// ParseNotificationIDInsensitively parses 'input' case-insensitively into a NotificationId +// note: this method should only be used for API response data and not user input +func ParseNotificationIDInsensitively(input string) (*NotificationId, error) { + parser := resourceids.NewParserFromResourceIdType(NotificationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NotificationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if v, ok := parsed.Parsed["notificationName"]; true { + if !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + } + + notificationName, err := parseNotificationName(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.NotificationName = *notificationName + } + + return &id, nil +} + +// ValidateNotificationID checks that 'input' can be parsed as a Notification ID +func ValidateNotificationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNotificationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Notification ID +func (id NotificationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/notifications/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, string(id.NotificationName)) +} + +// Segments returns a slice of Resource ID Segments which comprise this Notification ID +func (id NotificationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticNotifications", "notifications", "notifications"), + resourceids.ConstantSegment("notificationName", PossibleValuesForNotificationName(), "AccountClosedPublisher"), + } +} + +// String returns a human-readable description of this Notification ID +func (id NotificationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Notification Name: %q", string(id.NotificationName)), + } + return fmt.Sprintf("Notification (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_recipientemail.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_recipientemail.go new file mode 100644 index 000000000000..622fa5001baf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_recipientemail.go @@ -0,0 +1,169 @@ +package notificationrecipientemail + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = RecipientEmailId{} + +// RecipientEmailId is a struct representing the Resource ID for a Recipient Email +type RecipientEmailId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + NotificationName NotificationName + RecipientEmailName string +} + +// NewRecipientEmailID returns a new RecipientEmailId struct +func NewRecipientEmailID(subscriptionId string, resourceGroupName string, serviceName string, notificationName NotificationName, recipientEmailName string) RecipientEmailId { + return RecipientEmailId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + NotificationName: notificationName, + RecipientEmailName: recipientEmailName, + } +} + +// ParseRecipientEmailID parses 'input' into a RecipientEmailId +func ParseRecipientEmailID(input string) (*RecipientEmailId, error) { + parser := resourceids.NewParserFromResourceIdType(RecipientEmailId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RecipientEmailId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if v, ok := parsed.Parsed["notificationName"]; true { + if !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + } + + notificationName, err := parseNotificationName(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.NotificationName = *notificationName + } + + if id.RecipientEmailName, ok = parsed.Parsed["recipientEmailName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "recipientEmailName", *parsed) + } + + return &id, nil +} + +// ParseRecipientEmailIDInsensitively parses 'input' case-insensitively into a RecipientEmailId +// note: this method should only be used for API response data and not user input +func ParseRecipientEmailIDInsensitively(input string) (*RecipientEmailId, error) { + parser := resourceids.NewParserFromResourceIdType(RecipientEmailId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RecipientEmailId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if v, ok := parsed.Parsed["notificationName"]; true { + if !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + } + + notificationName, err := parseNotificationName(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.NotificationName = *notificationName + } + + if id.RecipientEmailName, ok = parsed.Parsed["recipientEmailName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "recipientEmailName", *parsed) + } + + return &id, nil +} + +// ValidateRecipientEmailID checks that 'input' can be parsed as a Recipient Email ID +func ValidateRecipientEmailID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRecipientEmailID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Recipient Email ID +func (id RecipientEmailId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/notifications/%s/recipientEmails/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, string(id.NotificationName), id.RecipientEmailName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Recipient Email ID +func (id RecipientEmailId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticNotifications", "notifications", "notifications"), + resourceids.ConstantSegment("notificationName", PossibleValuesForNotificationName(), "AccountClosedPublisher"), + resourceids.StaticSegment("staticRecipientEmails", "recipientEmails", "recipientEmails"), + resourceids.UserSpecifiedSegment("recipientEmailName", "recipientEmailValue"), + } +} + +// String returns a human-readable description of this Recipient Email ID +func (id RecipientEmailId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Notification Name: %q", string(id.NotificationName)), + fmt.Sprintf("Recipient Email Name: %q", id.RecipientEmailName), + } + return fmt.Sprintf("Recipient Email (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_checkentityexists.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_checkentityexists.go new file mode 100644 index 000000000000..acddee29b823 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_checkentityexists.go @@ -0,0 +1,46 @@ +package notificationrecipientemail + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckEntityExistsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CheckEntityExists ... +func (c NotificationRecipientEmailClient) CheckEntityExists(ctx context.Context, id RecipientEmailId) (result CheckEntityExistsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_createorupdate.go new file mode 100644 index 000000000000..076065b12a4d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_createorupdate.go @@ -0,0 +1,52 @@ +package notificationrecipientemail + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RecipientEmailContract +} + +// CreateOrUpdate ... +func (c NotificationRecipientEmailClient) CreateOrUpdate(ctx context.Context, id RecipientEmailId) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_delete.go new file mode 100644 index 000000000000..083dbc0417fa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_delete.go @@ -0,0 +1,47 @@ +package notificationrecipientemail + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c NotificationRecipientEmailClient) Delete(ctx context.Context, id RecipientEmailId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_listbynotification.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_listbynotification.go new file mode 100644 index 000000000000..091cf193ce9c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_listbynotification.go @@ -0,0 +1,52 @@ +package notificationrecipientemail + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByNotificationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RecipientEmailCollection +} + +// ListByNotification ... +func (c NotificationRecipientEmailClient) ListByNotification(ctx context.Context, id NotificationId) (result ListByNotificationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/recipientEmails", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/model_recipientemailcollection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/model_recipientemailcollection.go new file mode 100644 index 000000000000..b3b8d1227814 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/model_recipientemailcollection.go @@ -0,0 +1,10 @@ +package notificationrecipientemail + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecipientEmailCollection struct { + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]RecipientEmailContract `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/model_recipientemailcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/model_recipientemailcontract.go new file mode 100644 index 000000000000..08b49e04f7d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/model_recipientemailcontract.go @@ -0,0 +1,11 @@ +package notificationrecipientemail + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecipientEmailContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RecipientEmailContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/model_recipientemailcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/model_recipientemailcontractproperties.go new file mode 100644 index 000000000000..19b8d6b87875 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/model_recipientemailcontractproperties.go @@ -0,0 +1,8 @@ +package notificationrecipientemail + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecipientEmailContractProperties struct { + Email *string `json:"email,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/version.go new file mode 100644 index 000000000000..cb8c629d2f43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/version.go @@ -0,0 +1,12 @@ +package notificationrecipientemail + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/notificationrecipientemail/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/README.md new file mode 100644 index 000000000000..c8db11ac8f66 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/README.md @@ -0,0 +1,84 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser` Documentation + +The `notificationrecipientuser` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser" +``` + + +### Client Initialization + +```go +client := notificationrecipientuser.NewNotificationRecipientUserClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NotificationRecipientUserClient.CheckEntityExists` + +```go +ctx := context.TODO() +id := notificationrecipientuser.NewRecipientUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "AccountClosedPublisher", "userIdValue") + +read, err := client.CheckEntityExists(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationRecipientUserClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := notificationrecipientuser.NewRecipientUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "AccountClosedPublisher", "userIdValue") + +read, err := client.CreateOrUpdate(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationRecipientUserClient.Delete` + +```go +ctx := context.TODO() +id := notificationrecipientuser.NewRecipientUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "AccountClosedPublisher", "userIdValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationRecipientUserClient.ListByNotification` + +```go +ctx := context.TODO() +id := notificationrecipientuser.NewNotificationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "AccountClosedPublisher") + +read, err := client.ListByNotification(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/client.go new file mode 100644 index 000000000000..3049dccc74b0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/client.go @@ -0,0 +1,26 @@ +package notificationrecipientuser + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationRecipientUserClient struct { + Client *resourcemanager.Client +} + +func NewNotificationRecipientUserClientWithBaseURI(sdkApi sdkEnv.Api) (*NotificationRecipientUserClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "notificationrecipientuser", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NotificationRecipientUserClient: %+v", err) + } + + return &NotificationRecipientUserClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/constants.go new file mode 100644 index 000000000000..879dbf85c441 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/constants.go @@ -0,0 +1,66 @@ +package notificationrecipientuser + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationName string + +const ( + NotificationNameAccountClosedPublisher NotificationName = "AccountClosedPublisher" + NotificationNameBCC NotificationName = "BCC" + NotificationNameNewApplicationNotificationMessage NotificationName = "NewApplicationNotificationMessage" + NotificationNameNewIssuePublisherNotificationMessage NotificationName = "NewIssuePublisherNotificationMessage" + NotificationNamePurchasePublisherNotificationMessage NotificationName = "PurchasePublisherNotificationMessage" + NotificationNameQuotaLimitApproachingPublisherNotificationMessage NotificationName = "QuotaLimitApproachingPublisherNotificationMessage" + NotificationNameRequestPublisherNotificationMessage NotificationName = "RequestPublisherNotificationMessage" +) + +func PossibleValuesForNotificationName() []string { + return []string{ + string(NotificationNameAccountClosedPublisher), + string(NotificationNameBCC), + string(NotificationNameNewApplicationNotificationMessage), + string(NotificationNameNewIssuePublisherNotificationMessage), + string(NotificationNamePurchasePublisherNotificationMessage), + string(NotificationNameQuotaLimitApproachingPublisherNotificationMessage), + string(NotificationNameRequestPublisherNotificationMessage), + } +} + +func (s *NotificationName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNotificationName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNotificationName(input string) (*NotificationName, error) { + vals := map[string]NotificationName{ + "accountclosedpublisher": NotificationNameAccountClosedPublisher, + "bcc": NotificationNameBCC, + "newapplicationnotificationmessage": NotificationNameNewApplicationNotificationMessage, + "newissuepublishernotificationmessage": NotificationNameNewIssuePublisherNotificationMessage, + "purchasepublishernotificationmessage": NotificationNamePurchasePublisherNotificationMessage, + "quotalimitapproachingpublishernotificationmessage": NotificationNameQuotaLimitApproachingPublisherNotificationMessage, + "requestpublishernotificationmessage": NotificationNameRequestPublisherNotificationMessage, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NotificationName(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_notification.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_notification.go new file mode 100644 index 000000000000..9e0e8aebd257 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_notification.go @@ -0,0 +1,156 @@ +package notificationrecipientuser + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = NotificationId{} + +// NotificationId is a struct representing the Resource ID for a Notification +type NotificationId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + NotificationName NotificationName +} + +// NewNotificationID returns a new NotificationId struct +func NewNotificationID(subscriptionId string, resourceGroupName string, serviceName string, notificationName NotificationName) NotificationId { + return NotificationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + NotificationName: notificationName, + } +} + +// ParseNotificationID parses 'input' into a NotificationId +func ParseNotificationID(input string) (*NotificationId, error) { + parser := resourceids.NewParserFromResourceIdType(NotificationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NotificationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if v, ok := parsed.Parsed["notificationName"]; true { + if !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + } + + notificationName, err := parseNotificationName(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.NotificationName = *notificationName + } + + return &id, nil +} + +// ParseNotificationIDInsensitively parses 'input' case-insensitively into a NotificationId +// note: this method should only be used for API response data and not user input +func ParseNotificationIDInsensitively(input string) (*NotificationId, error) { + parser := resourceids.NewParserFromResourceIdType(NotificationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NotificationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if v, ok := parsed.Parsed["notificationName"]; true { + if !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + } + + notificationName, err := parseNotificationName(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.NotificationName = *notificationName + } + + return &id, nil +} + +// ValidateNotificationID checks that 'input' can be parsed as a Notification ID +func ValidateNotificationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNotificationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Notification ID +func (id NotificationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/notifications/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, string(id.NotificationName)) +} + +// Segments returns a slice of Resource ID Segments which comprise this Notification ID +func (id NotificationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticNotifications", "notifications", "notifications"), + resourceids.ConstantSegment("notificationName", PossibleValuesForNotificationName(), "AccountClosedPublisher"), + } +} + +// String returns a human-readable description of this Notification ID +func (id NotificationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Notification Name: %q", string(id.NotificationName)), + } + return fmt.Sprintf("Notification (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_recipientuser.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_recipientuser.go new file mode 100644 index 000000000000..ba60daeb64bc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_recipientuser.go @@ -0,0 +1,169 @@ +package notificationrecipientuser + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = RecipientUserId{} + +// RecipientUserId is a struct representing the Resource ID for a Recipient User +type RecipientUserId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + NotificationName NotificationName + UserId string +} + +// NewRecipientUserID returns a new RecipientUserId struct +func NewRecipientUserID(subscriptionId string, resourceGroupName string, serviceName string, notificationName NotificationName, userId string) RecipientUserId { + return RecipientUserId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + NotificationName: notificationName, + UserId: userId, + } +} + +// ParseRecipientUserID parses 'input' into a RecipientUserId +func ParseRecipientUserID(input string) (*RecipientUserId, error) { + parser := resourceids.NewParserFromResourceIdType(RecipientUserId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RecipientUserId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if v, ok := parsed.Parsed["notificationName"]; true { + if !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + } + + notificationName, err := parseNotificationName(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.NotificationName = *notificationName + } + + if id.UserId, ok = parsed.Parsed["userId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + } + + return &id, nil +} + +// ParseRecipientUserIDInsensitively parses 'input' case-insensitively into a RecipientUserId +// note: this method should only be used for API response data and not user input +func ParseRecipientUserIDInsensitively(input string) (*RecipientUserId, error) { + parser := resourceids.NewParserFromResourceIdType(RecipientUserId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RecipientUserId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if v, ok := parsed.Parsed["notificationName"]; true { + if !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + } + + notificationName, err := parseNotificationName(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.NotificationName = *notificationName + } + + if id.UserId, ok = parsed.Parsed["userId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + } + + return &id, nil +} + +// ValidateRecipientUserID checks that 'input' can be parsed as a Recipient User ID +func ValidateRecipientUserID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRecipientUserID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Recipient User ID +func (id RecipientUserId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/notifications/%s/recipientUsers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, string(id.NotificationName), id.UserId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Recipient User ID +func (id RecipientUserId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticNotifications", "notifications", "notifications"), + resourceids.ConstantSegment("notificationName", PossibleValuesForNotificationName(), "AccountClosedPublisher"), + resourceids.StaticSegment("staticRecipientUsers", "recipientUsers", "recipientUsers"), + resourceids.UserSpecifiedSegment("userId", "userIdValue"), + } +} + +// String returns a human-readable description of this Recipient User ID +func (id RecipientUserId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Notification Name: %q", string(id.NotificationName)), + fmt.Sprintf("User: %q", id.UserId), + } + return fmt.Sprintf("Recipient User (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_checkentityexists.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_checkentityexists.go new file mode 100644 index 000000000000..baae87b86d11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_checkentityexists.go @@ -0,0 +1,46 @@ +package notificationrecipientuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckEntityExistsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CheckEntityExists ... +func (c NotificationRecipientUserClient) CheckEntityExists(ctx context.Context, id RecipientUserId) (result CheckEntityExistsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_createorupdate.go new file mode 100644 index 000000000000..a9b12b60ca8c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_createorupdate.go @@ -0,0 +1,52 @@ +package notificationrecipientuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RecipientUserContract +} + +// CreateOrUpdate ... +func (c NotificationRecipientUserClient) CreateOrUpdate(ctx context.Context, id RecipientUserId) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_delete.go new file mode 100644 index 000000000000..d0bf672da2e5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_delete.go @@ -0,0 +1,47 @@ +package notificationrecipientuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c NotificationRecipientUserClient) Delete(ctx context.Context, id RecipientUserId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_listbynotification.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_listbynotification.go new file mode 100644 index 000000000000..bfe4badf1f5e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_listbynotification.go @@ -0,0 +1,52 @@ +package notificationrecipientuser + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByNotificationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RecipientUserCollection +} + +// ListByNotification ... +func (c NotificationRecipientUserClient) ListByNotification(ctx context.Context, id NotificationId) (result ListByNotificationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/recipientUsers", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/model_recipientusercollection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/model_recipientusercollection.go new file mode 100644 index 000000000000..d8580ed7e030 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/model_recipientusercollection.go @@ -0,0 +1,10 @@ +package notificationrecipientuser + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecipientUserCollection struct { + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]RecipientUserContract `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/model_recipientusercontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/model_recipientusercontract.go new file mode 100644 index 000000000000..9efe2cc90974 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/model_recipientusercontract.go @@ -0,0 +1,11 @@ +package notificationrecipientuser + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecipientUserContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RecipientUsersContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/model_recipientuserscontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/model_recipientuserscontractproperties.go new file mode 100644 index 000000000000..2c8303f3740f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/model_recipientuserscontractproperties.go @@ -0,0 +1,8 @@ +package notificationrecipientuser + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecipientUsersContractProperties struct { + UserId *string `json:"userId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/version.go new file mode 100644 index 000000000000..1534dfb22f67 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/version.go @@ -0,0 +1,12 @@ +package notificationrecipientuser + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/notificationrecipientuser/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/README.md new file mode 100644 index 000000000000..8df8a8fa06ea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/README.md @@ -0,0 +1,143 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider` Documentation + +The `openidconnectprovider` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider" +``` + + +### Client Initialization + +```go +client := openidconnectprovider.NewOpenidConnectProviderClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `OpenidConnectProviderClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := openidconnectprovider.NewOpenidConnectProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "openidConnectProviderValue") + +payload := openidconnectprovider.OpenidConnectProviderContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, openidconnectprovider.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `OpenidConnectProviderClient.Delete` + +```go +ctx := context.TODO() +id := openidconnectprovider.NewOpenidConnectProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "openidConnectProviderValue") + +read, err := client.Delete(ctx, id, openidconnectprovider.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `OpenidConnectProviderClient.Get` + +```go +ctx := context.TODO() +id := openidconnectprovider.NewOpenidConnectProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "openidConnectProviderValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `OpenidConnectProviderClient.GetEntityTag` + +```go +ctx := context.TODO() +id := openidconnectprovider.NewOpenidConnectProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "openidConnectProviderValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `OpenidConnectProviderClient.ListByService` + +```go +ctx := context.TODO() +id := openidconnectprovider.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, openidconnectprovider.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, openidconnectprovider.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `OpenidConnectProviderClient.ListSecrets` + +```go +ctx := context.TODO() +id := openidconnectprovider.NewOpenidConnectProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "openidConnectProviderValue") + +read, err := client.ListSecrets(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `OpenidConnectProviderClient.Update` + +```go +ctx := context.TODO() +id := openidconnectprovider.NewOpenidConnectProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "openidConnectProviderValue") + +payload := openidconnectprovider.OpenidConnectProviderUpdateContract{ + // ... +} + + +read, err := client.Update(ctx, id, payload, openidconnectprovider.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/client.go new file mode 100644 index 000000000000..6b2113dfc3d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/client.go @@ -0,0 +1,26 @@ +package openidconnectprovider + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OpenidConnectProviderClient struct { + Client *resourcemanager.Client +} + +func NewOpenidConnectProviderClientWithBaseURI(sdkApi sdkEnv.Api) (*OpenidConnectProviderClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "openidconnectprovider", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating OpenidConnectProviderClient: %+v", err) + } + + return &OpenidConnectProviderClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_openidconnectprovider.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_openidconnectprovider.go new file mode 100644 index 000000000000..4c21b8383e0b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_openidconnectprovider.go @@ -0,0 +1,140 @@ +package openidconnectprovider + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = OpenidConnectProviderId{} + +// OpenidConnectProviderId is a struct representing the Resource ID for a Openid Connect Provider +type OpenidConnectProviderId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + OpenidConnectProviderName string +} + +// NewOpenidConnectProviderID returns a new OpenidConnectProviderId struct +func NewOpenidConnectProviderID(subscriptionId string, resourceGroupName string, serviceName string, openidConnectProviderName string) OpenidConnectProviderId { + return OpenidConnectProviderId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + OpenidConnectProviderName: openidConnectProviderName, + } +} + +// ParseOpenidConnectProviderID parses 'input' into a OpenidConnectProviderId +func ParseOpenidConnectProviderID(input string) (*OpenidConnectProviderId, error) { + parser := resourceids.NewParserFromResourceIdType(OpenidConnectProviderId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OpenidConnectProviderId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.OpenidConnectProviderName, ok = parsed.Parsed["openidConnectProviderName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "openidConnectProviderName", *parsed) + } + + return &id, nil +} + +// ParseOpenidConnectProviderIDInsensitively parses 'input' case-insensitively into a OpenidConnectProviderId +// note: this method should only be used for API response data and not user input +func ParseOpenidConnectProviderIDInsensitively(input string) (*OpenidConnectProviderId, error) { + parser := resourceids.NewParserFromResourceIdType(OpenidConnectProviderId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OpenidConnectProviderId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.OpenidConnectProviderName, ok = parsed.Parsed["openidConnectProviderName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "openidConnectProviderName", *parsed) + } + + return &id, nil +} + +// ValidateOpenidConnectProviderID checks that 'input' can be parsed as a Openid Connect Provider ID +func ValidateOpenidConnectProviderID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseOpenidConnectProviderID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Openid Connect Provider ID +func (id OpenidConnectProviderId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/openidConnectProviders/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.OpenidConnectProviderName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Openid Connect Provider ID +func (id OpenidConnectProviderId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticOpenidConnectProviders", "openidConnectProviders", "openidConnectProviders"), + resourceids.UserSpecifiedSegment("openidConnectProviderName", "openidConnectProviderValue"), + } +} + +// String returns a human-readable description of this Openid Connect Provider ID +func (id OpenidConnectProviderId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Openid Connect Provider Name: %q", id.OpenidConnectProviderName), + } + return fmt.Sprintf("Openid Connect Provider (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_service.go new file mode 100644 index 000000000000..5c1589b41302 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_service.go @@ -0,0 +1,127 @@ +package openidconnectprovider + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_createorupdate.go new file mode 100644 index 000000000000..022112dd8eea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_createorupdate.go @@ -0,0 +1,85 @@ +package openidconnectprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OpenidConnectProviderContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c OpenidConnectProviderClient) CreateOrUpdate(ctx context.Context, id OpenidConnectProviderId, input OpenidConnectProviderContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_delete.go new file mode 100644 index 000000000000..dd6f6bbf9c4b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_delete.go @@ -0,0 +1,76 @@ +package openidconnectprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c OpenidConnectProviderClient) Delete(ctx context.Context, id OpenidConnectProviderId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_get.go new file mode 100644 index 000000000000..25939c8a1ced --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_get.go @@ -0,0 +1,51 @@ +package openidconnectprovider + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OpenidConnectProviderContract +} + +// Get ... +func (c OpenidConnectProviderClient) Get(ctx context.Context, id OpenidConnectProviderId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_getentitytag.go new file mode 100644 index 000000000000..3f411d67cae7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_getentitytag.go @@ -0,0 +1,46 @@ +package openidconnectprovider + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c OpenidConnectProviderClient) GetEntityTag(ctx context.Context, id OpenidConnectProviderId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listbyservice.go new file mode 100644 index 000000000000..42ba42327c50 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listbyservice.go @@ -0,0 +1,125 @@ +package openidconnectprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]OpenidConnectProviderContract +} + +type ListByServiceCompleteResult struct { + Items []OpenidConnectProviderContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c OpenidConnectProviderClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/openidConnectProviders", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]OpenidConnectProviderContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c OpenidConnectProviderClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, OpenidConnectProviderContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c OpenidConnectProviderClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate OpenidConnectProviderContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]OpenidConnectProviderContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listsecrets.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listsecrets.go new file mode 100644 index 000000000000..d05b3d3c3650 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listsecrets.go @@ -0,0 +1,52 @@ +package openidconnectprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ClientSecretContract +} + +// ListSecrets ... +func (c OpenidConnectProviderClient) ListSecrets(ctx context.Context, id OpenidConnectProviderId) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_update.go new file mode 100644 index 000000000000..5b2402019c00 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_update.go @@ -0,0 +1,84 @@ +package openidconnectprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OpenidConnectProviderContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c OpenidConnectProviderClient) Update(ctx context.Context, id OpenidConnectProviderId, input OpenidConnectProviderUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_clientsecretcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_clientsecretcontract.go new file mode 100644 index 000000000000..c557135ce962 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_clientsecretcontract.go @@ -0,0 +1,8 @@ +package openidconnectprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClientSecretContract struct { + ClientSecret *string `json:"clientSecret,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectprovidercontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectprovidercontract.go new file mode 100644 index 000000000000..a49188977edf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectprovidercontract.go @@ -0,0 +1,11 @@ +package openidconnectprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OpenidConnectProviderContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *OpenidConnectProviderContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectprovidercontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectprovidercontractproperties.go new file mode 100644 index 000000000000..151a623ece60 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectprovidercontractproperties.go @@ -0,0 +1,12 @@ +package openidconnectprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OpenidConnectProviderContractProperties struct { + ClientId string `json:"clientId"` + ClientSecret *string `json:"clientSecret,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName string `json:"displayName"` + MetadataEndpoint string `json:"metadataEndpoint"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectproviderupdatecontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectproviderupdatecontract.go new file mode 100644 index 000000000000..bdac084e19d1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectproviderupdatecontract.go @@ -0,0 +1,8 @@ +package openidconnectprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OpenidConnectProviderUpdateContract struct { + Properties *OpenidConnectProviderUpdateContractProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectproviderupdatecontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectproviderupdatecontractproperties.go new file mode 100644 index 000000000000..901e4cfcca84 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/model_openidconnectproviderupdatecontractproperties.go @@ -0,0 +1,12 @@ +package openidconnectprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OpenidConnectProviderUpdateContractProperties struct { + ClientId *string `json:"clientId,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/predicates.go new file mode 100644 index 000000000000..9a85ff23a160 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/predicates.go @@ -0,0 +1,27 @@ +package openidconnectprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OpenidConnectProviderContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p OpenidConnectProviderContractOperationPredicate) Matches(input OpenidConnectProviderContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/version.go new file mode 100644 index 000000000000..b35a352104a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider/version.go @@ -0,0 +1,12 @@ +package openidconnectprovider + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/openidconnectprovider/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/README.md new file mode 100644 index 000000000000..013641fcf198 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/README.md @@ -0,0 +1,105 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy` Documentation + +The `policy` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy" +``` + + +### Client Initialization + +```go +client := policy.NewPolicyClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PolicyClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := policy.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +payload := policy.PolicyContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, policy.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PolicyClient.Delete` + +```go +ctx := context.TODO() +id := policy.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +read, err := client.Delete(ctx, id, policy.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PolicyClient.Get` + +```go +ctx := context.TODO() +id := policy.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +read, err := client.Get(ctx, id, policy.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PolicyClient.GetEntityTag` + +```go +ctx := context.TODO() +id := policy.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PolicyClient.ListByService` + +```go +ctx := context.TODO() +id := policy.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +read, err := client.ListByService(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/client.go new file mode 100644 index 000000000000..216d1f1ff33a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/client.go @@ -0,0 +1,26 @@ +package policy + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyClient struct { + Client *resourcemanager.Client +} + +func NewPolicyClientWithBaseURI(sdkApi sdkEnv.Api) (*PolicyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "policy", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PolicyClient: %+v", err) + } + + return &PolicyClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/constants.go new file mode 100644 index 000000000000..10a4650a3955 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/constants.go @@ -0,0 +1,98 @@ +package policy + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyContentFormat string + +const ( + PolicyContentFormatRawxml PolicyContentFormat = "rawxml" + PolicyContentFormatRawxmlNegativelink PolicyContentFormat = "rawxml-link" + PolicyContentFormatXml PolicyContentFormat = "xml" + PolicyContentFormatXmlNegativelink PolicyContentFormat = "xml-link" +) + +func PossibleValuesForPolicyContentFormat() []string { + return []string{ + string(PolicyContentFormatRawxml), + string(PolicyContentFormatRawxmlNegativelink), + string(PolicyContentFormatXml), + string(PolicyContentFormatXmlNegativelink), + } +} + +func (s *PolicyContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePolicyContentFormat(input string) (*PolicyContentFormat, error) { + vals := map[string]PolicyContentFormat{ + "rawxml": PolicyContentFormatRawxml, + "rawxml-link": PolicyContentFormatRawxmlNegativelink, + "xml": PolicyContentFormatXml, + "xml-link": PolicyContentFormatXmlNegativelink, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyContentFormat(input) + return &out, nil +} + +type PolicyExportFormat string + +const ( + PolicyExportFormatRawxml PolicyExportFormat = "rawxml" + PolicyExportFormatXml PolicyExportFormat = "xml" +) + +func PossibleValuesForPolicyExportFormat() []string { + return []string{ + string(PolicyExportFormatRawxml), + string(PolicyExportFormatXml), + } +} + +func (s *PolicyExportFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyExportFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePolicyExportFormat(input string) (*PolicyExportFormat, error) { + vals := map[string]PolicyExportFormat{ + "rawxml": PolicyExportFormatRawxml, + "xml": PolicyExportFormatXml, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyExportFormat(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/id_service.go new file mode 100644 index 000000000000..abd4ff17b684 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/id_service.go @@ -0,0 +1,127 @@ +package policy + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_createorupdate.go new file mode 100644 index 000000000000..0303d637d5ea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_createorupdate.go @@ -0,0 +1,85 @@ +package policy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c PolicyClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_delete.go new file mode 100644 index 000000000000..4ddd78e13cb7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_delete.go @@ -0,0 +1,76 @@ +package policy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c PolicyClient) Delete(ctx context.Context, id ServiceId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_get.go new file mode 100644 index 000000000000..829e84ff74d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_get.go @@ -0,0 +1,80 @@ +package policy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type GetOperationOptions struct { + Format *PolicyExportFormat +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + return &out +} + +// Get ... +func (c PolicyClient) Get(ctx context.Context, id ServiceId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_getentitytag.go new file mode 100644 index 000000000000..d8575a5f4cae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_getentitytag.go @@ -0,0 +1,47 @@ +package policy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c PolicyClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_listbyservice.go new file mode 100644 index 000000000000..2cba37b4dd02 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/method_listbyservice.go @@ -0,0 +1,52 @@ +package policy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyCollection +} + +// ListByService ... +func (c PolicyClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/model_policycollection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/model_policycollection.go new file mode 100644 index 000000000000..02c6249538b2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/model_policycollection.go @@ -0,0 +1,10 @@ +package policy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyCollection struct { + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]PolicyContract `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/model_policycontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/model_policycontract.go new file mode 100644 index 000000000000..72047b56ce64 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/model_policycontract.go @@ -0,0 +1,11 @@ +package policy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PolicyContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/model_policycontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/model_policycontractproperties.go new file mode 100644 index 000000000000..a74af5231170 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/model_policycontractproperties.go @@ -0,0 +1,9 @@ +package policy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyContractProperties struct { + Format *PolicyContentFormat `json:"format,omitempty"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/version.go new file mode 100644 index 000000000000..86924b26231c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy/version.go @@ -0,0 +1,12 @@ +package policy + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/policy/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/README.md new file mode 100644 index 000000000000..3815b05c54a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product` Documentation + +The `product` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product" +``` + + +### Client Initialization + +```go +client := product.NewProductClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ProductClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := product.NewProductID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue") + +payload := product.ProductContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, product.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductClient.Delete` + +```go +ctx := context.TODO() +id := product.NewProductID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue") + +read, err := client.Delete(ctx, id, product.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductClient.Get` + +```go +ctx := context.TODO() +id := product.NewProductID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductClient.GetEntityTag` + +```go +ctx := context.TODO() +id := product.NewProductID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductClient.ListByService` + +```go +ctx := context.TODO() +id := product.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, product.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, product.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ProductClient.Update` + +```go +ctx := context.TODO() +id := product.NewProductID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue") + +payload := product.ProductUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload, product.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/client.go new file mode 100644 index 000000000000..20069da6c204 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/client.go @@ -0,0 +1,26 @@ +package product + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProductClient struct { + Client *resourcemanager.Client +} + +func NewProductClientWithBaseURI(sdkApi sdkEnv.Api) (*ProductClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "product", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductClient: %+v", err) + } + + return &ProductClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/constants.go new file mode 100644 index 000000000000..b1aa827fdb27 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/constants.go @@ -0,0 +1,51 @@ +package product + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProductState string + +const ( + ProductStateNotPublished ProductState = "notPublished" + ProductStatePublished ProductState = "published" +) + +func PossibleValuesForProductState() []string { + return []string{ + string(ProductStateNotPublished), + string(ProductStatePublished), + } +} + +func (s *ProductState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProductState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProductState(input string) (*ProductState, error) { + vals := map[string]ProductState{ + "notpublished": ProductStateNotPublished, + "published": ProductStatePublished, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProductState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/id_product.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/id_product.go new file mode 100644 index 000000000000..68fc58b3c0c9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/id_product.go @@ -0,0 +1,140 @@ +package product + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ProductId{} + +// ProductId is a struct representing the Resource ID for a Product +type ProductId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ProductId string +} + +// NewProductID returns a new ProductId struct +func NewProductID(subscriptionId string, resourceGroupName string, serviceName string, productId string) ProductId { + return ProductId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ProductId: productId, + } +} + +// ParseProductID parses 'input' into a ProductId +func ParseProductID(input string) (*ProductId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + return &id, nil +} + +// ParseProductIDInsensitively parses 'input' case-insensitively into a ProductId +// note: this method should only be used for API response data and not user input +func ParseProductIDInsensitively(input string) (*ProductId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + return &id, nil +} + +// ValidateProductID checks that 'input' can be parsed as a Product ID +func ValidateProductID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProductID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Product ID +func (id ProductId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/products/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ProductId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Product ID +func (id ProductId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticProducts", "products", "products"), + resourceids.UserSpecifiedSegment("productId", "productIdValue"), + } +} + +// String returns a human-readable description of this Product ID +func (id ProductId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Product: %q", id.ProductId), + } + return fmt.Sprintf("Product (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/id_service.go new file mode 100644 index 000000000000..453a38674d72 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/id_service.go @@ -0,0 +1,127 @@ +package product + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_createorupdate.go new file mode 100644 index 000000000000..dc69508e31cc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_createorupdate.go @@ -0,0 +1,85 @@ +package product + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProductContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ProductClient) CreateOrUpdate(ctx context.Context, id ProductId, input ProductContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_delete.go new file mode 100644 index 000000000000..a2aebab1182e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_delete.go @@ -0,0 +1,79 @@ +package product + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + DeleteSubscriptions *bool + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.DeleteSubscriptions != nil { + out.Append("deleteSubscriptions", fmt.Sprintf("%v", *o.DeleteSubscriptions)) + } + return &out +} + +// Delete ... +func (c ProductClient) Delete(ctx context.Context, id ProductId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_get.go new file mode 100644 index 000000000000..41152aebc0ab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_get.go @@ -0,0 +1,51 @@ +package product + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProductContract +} + +// Get ... +func (c ProductClient) Get(ctx context.Context, id ProductId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_getentitytag.go new file mode 100644 index 000000000000..667f4afad59d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_getentitytag.go @@ -0,0 +1,46 @@ +package product + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ProductClient) GetEntityTag(ctx context.Context, id ProductId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_listbyservice.go new file mode 100644 index 000000000000..66a835096aaa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_listbyservice.go @@ -0,0 +1,133 @@ +package product + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ProductContract +} + +type ListByServiceCompleteResult struct { + Items []ProductContract +} + +type ListByServiceOperationOptions struct { + ExpandGroups *bool + Filter *string + Skip *int64 + Tags *string + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ExpandGroups != nil { + out.Append("expandGroups", fmt.Sprintf("%v", *o.ExpandGroups)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Tags != nil { + out.Append("tags", fmt.Sprintf("%v", *o.Tags)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ProductClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/products", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ProductContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ProductClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ProductContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate ProductContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ProductContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_update.go new file mode 100644 index 000000000000..a9a59bd595e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/method_update.go @@ -0,0 +1,84 @@ +package product + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProductContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ProductClient) Update(ctx context.Context, id ProductId, input ProductUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productcontract.go new file mode 100644 index 000000000000..1d9178e386f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productcontract.go @@ -0,0 +1,11 @@ +package product + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProductContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ProductContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productcontractproperties.go new file mode 100644 index 000000000000..2ea12125c8b0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productcontractproperties.go @@ -0,0 +1,14 @@ +package product + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProductContractProperties struct { + ApprovalRequired *bool `json:"approvalRequired,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName string `json:"displayName"` + State *ProductState `json:"state,omitempty"` + SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` + SubscriptionsLimit *int64 `json:"subscriptionsLimit,omitempty"` + Terms *string `json:"terms,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productupdateparameters.go new file mode 100644 index 000000000000..d2d10c73851b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productupdateparameters.go @@ -0,0 +1,8 @@ +package product + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProductUpdateParameters struct { + Properties *ProductUpdateProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productupdateproperties.go new file mode 100644 index 000000000000..ba683a371cc5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/model_productupdateproperties.go @@ -0,0 +1,14 @@ +package product + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProductUpdateProperties struct { + ApprovalRequired *bool `json:"approvalRequired,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + State *ProductState `json:"state,omitempty"` + SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` + SubscriptionsLimit *int64 `json:"subscriptionsLimit,omitempty"` + Terms *string `json:"terms,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/predicates.go new file mode 100644 index 000000000000..7e24e47c6fc8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/predicates.go @@ -0,0 +1,27 @@ +package product + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProductContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ProductContractOperationPredicate) Matches(input ProductContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/version.go new file mode 100644 index 000000000000..b147ea8f3a6a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product/version.go @@ -0,0 +1,12 @@ +package product + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/product/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/README.md new file mode 100644 index 000000000000..f8f134870f31 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/README.md @@ -0,0 +1,85 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi` Documentation + +The `productapi` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi" +``` + + +### Client Initialization + +```go +client := productapi.NewProductApiClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ProductApiClient.CheckEntityExists` + +```go +ctx := context.TODO() +id := productapi.NewProductApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue", "apiIdValue") + +read, err := client.CheckEntityExists(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductApiClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := productapi.NewProductApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue", "apiIdValue") + +read, err := client.CreateOrUpdate(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductApiClient.Delete` + +```go +ctx := context.TODO() +id := productapi.NewProductApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue", "apiIdValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductApiClient.ListByProduct` + +```go +ctx := context.TODO() +id := productapi.NewProductID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue") + +// alternatively `client.ListByProduct(ctx, id, productapi.DefaultListByProductOperationOptions())` can be used to do batched pagination +items, err := client.ListByProductComplete(ctx, id, productapi.DefaultListByProductOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/client.go new file mode 100644 index 000000000000..1e0b184ff579 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/client.go @@ -0,0 +1,26 @@ +package productapi + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProductApiClient struct { + Client *resourcemanager.Client +} + +func NewProductApiClientWithBaseURI(sdkApi sdkEnv.Api) (*ProductApiClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "productapi", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductApiClient: %+v", err) + } + + return &ProductApiClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/constants.go new file mode 100644 index 000000000000..a2efe7f06410 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/constants.go @@ -0,0 +1,189 @@ +package productapi + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiType string + +const ( + ApiTypeGraphql ApiType = "graphql" + ApiTypeHTTP ApiType = "http" + ApiTypeSoap ApiType = "soap" + ApiTypeWebsocket ApiType = "websocket" +) + +func PossibleValuesForApiType() []string { + return []string{ + string(ApiTypeGraphql), + string(ApiTypeHTTP), + string(ApiTypeSoap), + string(ApiTypeWebsocket), + } +} + +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApiType(input string) (*ApiType, error) { + vals := map[string]ApiType{ + "graphql": ApiTypeGraphql, + "http": ApiTypeHTTP, + "soap": ApiTypeSoap, + "websocket": ApiTypeWebsocket, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApiType(input) + return &out, nil +} + +type BearerTokenSendingMethods string + +const ( + BearerTokenSendingMethodsAuthorizationHeader BearerTokenSendingMethods = "authorizationHeader" + BearerTokenSendingMethodsQuery BearerTokenSendingMethods = "query" +) + +func PossibleValuesForBearerTokenSendingMethods() []string { + return []string{ + string(BearerTokenSendingMethodsAuthorizationHeader), + string(BearerTokenSendingMethodsQuery), + } +} + +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { + vals := map[string]BearerTokenSendingMethods{ + "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, + "query": BearerTokenSendingMethodsQuery, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BearerTokenSendingMethods(input) + return &out, nil +} + +type Protocol string + +const ( + ProtocolHTTP Protocol = "http" + ProtocolHTTPS Protocol = "https" + ProtocolWs Protocol = "ws" + ProtocolWss Protocol = "wss" +) + +func PossibleValuesForProtocol() []string { + return []string{ + string(ProtocolHTTP), + string(ProtocolHTTPS), + string(ProtocolWs), + string(ProtocolWss), + } +} + +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocol(input string) (*Protocol, error) { + vals := map[string]Protocol{ + "http": ProtocolHTTP, + "https": ProtocolHTTPS, + "ws": ProtocolWs, + "wss": ProtocolWss, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Protocol(input) + return &out, nil +} + +type VersioningScheme string + +const ( + VersioningSchemeHeader VersioningScheme = "Header" + VersioningSchemeQuery VersioningScheme = "Query" + VersioningSchemeSegment VersioningScheme = "Segment" +) + +func PossibleValuesForVersioningScheme() []string { + return []string{ + string(VersioningSchemeHeader), + string(VersioningSchemeQuery), + string(VersioningSchemeSegment), + } +} + +func (s *VersioningScheme) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVersioningScheme(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVersioningScheme(input string) (*VersioningScheme, error) { + vals := map[string]VersioningScheme{ + "header": VersioningSchemeHeader, + "query": VersioningSchemeQuery, + "segment": VersioningSchemeSegment, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VersioningScheme(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/id_product.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/id_product.go new file mode 100644 index 000000000000..ab13414a812b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/id_product.go @@ -0,0 +1,140 @@ +package productapi + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ProductId{} + +// ProductId is a struct representing the Resource ID for a Product +type ProductId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ProductId string +} + +// NewProductID returns a new ProductId struct +func NewProductID(subscriptionId string, resourceGroupName string, serviceName string, productId string) ProductId { + return ProductId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ProductId: productId, + } +} + +// ParseProductID parses 'input' into a ProductId +func ParseProductID(input string) (*ProductId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + return &id, nil +} + +// ParseProductIDInsensitively parses 'input' case-insensitively into a ProductId +// note: this method should only be used for API response data and not user input +func ParseProductIDInsensitively(input string) (*ProductId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + return &id, nil +} + +// ValidateProductID checks that 'input' can be parsed as a Product ID +func ValidateProductID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProductID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Product ID +func (id ProductId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/products/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ProductId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Product ID +func (id ProductId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticProducts", "products", "products"), + resourceids.UserSpecifiedSegment("productId", "productIdValue"), + } +} + +// String returns a human-readable description of this Product ID +func (id ProductId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Product: %q", id.ProductId), + } + return fmt.Sprintf("Product (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/id_productapi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/id_productapi.go new file mode 100644 index 000000000000..241d1d4221d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/id_productapi.go @@ -0,0 +1,153 @@ +package productapi + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ProductApiId{} + +// ProductApiId is a struct representing the Resource ID for a Product Api +type ProductApiId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ProductId string + ApiId string +} + +// NewProductApiID returns a new ProductApiId struct +func NewProductApiID(subscriptionId string, resourceGroupName string, serviceName string, productId string, apiId string) ProductApiId { + return ProductApiId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ProductId: productId, + ApiId: apiId, + } +} + +// ParseProductApiID parses 'input' into a ProductApiId +func ParseProductApiID(input string) (*ProductApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductApiId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ParseProductApiIDInsensitively parses 'input' case-insensitively into a ProductApiId +// note: this method should only be used for API response data and not user input +func ParseProductApiIDInsensitively(input string) (*ProductApiId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductApiId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductApiId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + } + + return &id, nil +} + +// ValidateProductApiID checks that 'input' can be parsed as a Product Api ID +func ValidateProductApiID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProductApiID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Product Api ID +func (id ProductApiId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/products/%s/apis/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ProductId, id.ApiId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Product Api ID +func (id ProductApiId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticProducts", "products", "products"), + resourceids.UserSpecifiedSegment("productId", "productIdValue"), + resourceids.StaticSegment("staticApis", "apis", "apis"), + resourceids.UserSpecifiedSegment("apiId", "apiIdValue"), + } +} + +// String returns a human-readable description of this Product Api ID +func (id ProductApiId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Product: %q", id.ProductId), + fmt.Sprintf("Api: %q", id.ApiId), + } + return fmt.Sprintf("Product Api (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_checkentityexists.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_checkentityexists.go new file mode 100644 index 000000000000..69d91adfcefb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_checkentityexists.go @@ -0,0 +1,46 @@ +package productapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckEntityExistsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CheckEntityExists ... +func (c ProductApiClient) CheckEntityExists(ctx context.Context, id ProductApiId) (result CheckEntityExistsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_createorupdate.go new file mode 100644 index 000000000000..cfa64d596950 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_createorupdate.go @@ -0,0 +1,52 @@ +package productapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiContract +} + +// CreateOrUpdate ... +func (c ProductApiClient) CreateOrUpdate(ctx context.Context, id ProductApiId) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_delete.go new file mode 100644 index 000000000000..da188ce2e727 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_delete.go @@ -0,0 +1,47 @@ +package productapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ProductApiClient) Delete(ctx context.Context, id ProductApiId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_listbyproduct.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_listbyproduct.go new file mode 100644 index 000000000000..fbe56652d12b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/method_listbyproduct.go @@ -0,0 +1,125 @@ +package productapi + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiContract +} + +type ListByProductCompleteResult struct { + Items []ApiContract +} + +type ListByProductOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByProductOperationOptions() ListByProductOperationOptions { + return ListByProductOperationOptions{} +} + +func (o ListByProductOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByProductOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByProductOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByProduct ... +func (c ProductApiClient) ListByProduct(ctx context.Context, id ProductId, options ListByProductOperationOptions) (result ListByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/apis", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByProductComplete retrieves all the results into a single object +func (c ProductApiClient) ListByProductComplete(ctx context.Context, id ProductId, options ListByProductOperationOptions) (ListByProductCompleteResult, error) { + return c.ListByProductCompleteMatchingPredicate(ctx, id, options, ApiContractOperationPredicate{}) +} + +// ListByProductCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductApiClient) ListByProductCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListByProductOperationOptions, predicate ApiContractOperationPredicate) (result ListByProductCompleteResult, err error) { + items := make([]ApiContract, 0) + + resp, err := c.ListByProduct(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByProductCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apicontactinformation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apicontactinformation.go new file mode 100644 index 000000000000..431b237a6719 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apicontactinformation.go @@ -0,0 +1,10 @@ +package productapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiContactInformation struct { + Email *string `json:"email,omitempty"` + Name *string `json:"name,omitempty"` + Url *string `json:"url,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apicontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apicontract.go new file mode 100644 index 000000000000..e572fdbd27cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apicontract.go @@ -0,0 +1,11 @@ +package productapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ApiContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apicontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apicontractproperties.go new file mode 100644 index 000000000000..af49c49c9450 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apicontractproperties.go @@ -0,0 +1,28 @@ +package productapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiContractProperties struct { + ApiRevision *string `json:"apiRevision,omitempty"` + ApiRevisionDescription *string `json:"apiRevisionDescription,omitempty"` + ApiVersion *string `json:"apiVersion,omitempty"` + ApiVersionDescription *string `json:"apiVersionDescription,omitempty"` + ApiVersionSet *ApiVersionSetContractDetails `json:"apiVersionSet,omitempty"` + ApiVersionSetId *string `json:"apiVersionSetId,omitempty"` + AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` + Contact *ApiContactInformation `json:"contact,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + IsCurrent *bool `json:"isCurrent,omitempty"` + IsOnline *bool `json:"isOnline,omitempty"` + License *ApiLicenseInformation `json:"license,omitempty"` + Path string `json:"path"` + Protocols *[]Protocol `json:"protocols,omitempty"` + ServiceUrl *string `json:"serviceUrl,omitempty"` + SourceApiId *string `json:"sourceApiId,omitempty"` + SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` + SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` + TermsOfServiceUrl *string `json:"termsOfServiceUrl,omitempty"` + Type *ApiType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apilicenseinformation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apilicenseinformation.go new file mode 100644 index 000000000000..f5e72e56e416 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apilicenseinformation.go @@ -0,0 +1,9 @@ +package productapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiLicenseInformation struct { + Name *string `json:"name,omitempty"` + Url *string `json:"url,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apiversionsetcontractdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apiversionsetcontractdetails.go new file mode 100644 index 000000000000..8c641b33a98b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_apiversionsetcontractdetails.go @@ -0,0 +1,13 @@ +package productapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiVersionSetContractDetails struct { + Description *string `json:"description,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + VersionHeaderName *string `json:"versionHeaderName,omitempty"` + VersionQueryName *string `json:"versionQueryName,omitempty"` + VersioningScheme *VersioningScheme `json:"versioningScheme,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_authenticationsettingscontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_authenticationsettingscontract.go new file mode 100644 index 000000000000..f621c18edca6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_authenticationsettingscontract.go @@ -0,0 +1,9 @@ +package productapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthenticationSettingsContract struct { + OAuth2 *OAuth2AuthenticationSettingsContract `json:"oAuth2,omitempty"` + Openid *OpenIdAuthenticationSettingsContract `json:"openid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_oauth2authenticationsettingscontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_oauth2authenticationsettingscontract.go new file mode 100644 index 000000000000..71d199bd5502 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_oauth2authenticationsettingscontract.go @@ -0,0 +1,9 @@ +package productapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OAuth2AuthenticationSettingsContract struct { + AuthorizationServerId *string `json:"authorizationServerId,omitempty"` + Scope *string `json:"scope,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_openidauthenticationsettingscontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_openidauthenticationsettingscontract.go new file mode 100644 index 000000000000..3117a33ca1b0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_openidauthenticationsettingscontract.go @@ -0,0 +1,9 @@ +package productapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OpenIdAuthenticationSettingsContract struct { + BearerTokenSendingMethods *[]BearerTokenSendingMethods `json:"bearerTokenSendingMethods,omitempty"` + OpenidProviderId *string `json:"openidProviderId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_subscriptionkeyparameternamescontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_subscriptionkeyparameternamescontract.go new file mode 100644 index 000000000000..15514f68803e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/model_subscriptionkeyparameternamescontract.go @@ -0,0 +1,9 @@ +package productapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionKeyParameterNamesContract struct { + Header *string `json:"header,omitempty"` + Query *string `json:"query,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/predicates.go new file mode 100644 index 000000000000..291c7d4c7b5b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/predicates.go @@ -0,0 +1,27 @@ +package productapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ApiContractOperationPredicate) Matches(input ApiContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/version.go new file mode 100644 index 000000000000..2ba97e358842 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi/version.go @@ -0,0 +1,12 @@ +package productapi + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/productapi/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/README.md new file mode 100644 index 000000000000..5b652d6bfa54 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/README.md @@ -0,0 +1,85 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup` Documentation + +The `productgroup` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup" +``` + + +### Client Initialization + +```go +client := productgroup.NewProductGroupClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ProductGroupClient.CheckEntityExists` + +```go +ctx := context.TODO() +id := productgroup.NewProductGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue", "groupIdValue") + +read, err := client.CheckEntityExists(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductGroupClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := productgroup.NewProductGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue", "groupIdValue") + +read, err := client.CreateOrUpdate(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductGroupClient.Delete` + +```go +ctx := context.TODO() +id := productgroup.NewProductGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue", "groupIdValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductGroupClient.ListByProduct` + +```go +ctx := context.TODO() +id := productgroup.NewProductID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue") + +// alternatively `client.ListByProduct(ctx, id, productgroup.DefaultListByProductOperationOptions())` can be used to do batched pagination +items, err := client.ListByProductComplete(ctx, id, productgroup.DefaultListByProductOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/client.go new file mode 100644 index 000000000000..beb9159e3e37 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/client.go @@ -0,0 +1,26 @@ +package productgroup + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProductGroupClient struct { + Client *resourcemanager.Client +} + +func NewProductGroupClientWithBaseURI(sdkApi sdkEnv.Api) (*ProductGroupClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "productgroup", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductGroupClient: %+v", err) + } + + return &ProductGroupClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/constants.go new file mode 100644 index 000000000000..6ff85f660bdf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/constants.go @@ -0,0 +1,54 @@ +package productgroup + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupType string + +const ( + GroupTypeCustom GroupType = "custom" + GroupTypeExternal GroupType = "external" + GroupTypeSystem GroupType = "system" +) + +func PossibleValuesForGroupType() []string { + return []string{ + string(GroupTypeCustom), + string(GroupTypeExternal), + string(GroupTypeSystem), + } +} + +func (s *GroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseGroupType(input string) (*GroupType, error) { + vals := map[string]GroupType{ + "custom": GroupTypeCustom, + "external": GroupTypeExternal, + "system": GroupTypeSystem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GroupType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/id_product.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/id_product.go new file mode 100644 index 000000000000..78d1bbc00286 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/id_product.go @@ -0,0 +1,140 @@ +package productgroup + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ProductId{} + +// ProductId is a struct representing the Resource ID for a Product +type ProductId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ProductId string +} + +// NewProductID returns a new ProductId struct +func NewProductID(subscriptionId string, resourceGroupName string, serviceName string, productId string) ProductId { + return ProductId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ProductId: productId, + } +} + +// ParseProductID parses 'input' into a ProductId +func ParseProductID(input string) (*ProductId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + return &id, nil +} + +// ParseProductIDInsensitively parses 'input' case-insensitively into a ProductId +// note: this method should only be used for API response data and not user input +func ParseProductIDInsensitively(input string) (*ProductId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + return &id, nil +} + +// ValidateProductID checks that 'input' can be parsed as a Product ID +func ValidateProductID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProductID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Product ID +func (id ProductId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/products/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ProductId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Product ID +func (id ProductId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticProducts", "products", "products"), + resourceids.UserSpecifiedSegment("productId", "productIdValue"), + } +} + +// String returns a human-readable description of this Product ID +func (id ProductId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Product: %q", id.ProductId), + } + return fmt.Sprintf("Product (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/id_productgroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/id_productgroup.go new file mode 100644 index 000000000000..3da15ed373b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/id_productgroup.go @@ -0,0 +1,153 @@ +package productgroup + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ProductGroupId{} + +// ProductGroupId is a struct representing the Resource ID for a Product Group +type ProductGroupId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ProductId string + GroupId string +} + +// NewProductGroupID returns a new ProductGroupId struct +func NewProductGroupID(subscriptionId string, resourceGroupName string, serviceName string, productId string, groupId string) ProductGroupId { + return ProductGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ProductId: productId, + GroupId: groupId, + } +} + +// ParseProductGroupID parses 'input' into a ProductGroupId +func ParseProductGroupID(input string) (*ProductGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + } + + return &id, nil +} + +// ParseProductGroupIDInsensitively parses 'input' case-insensitively into a ProductGroupId +// note: this method should only be used for API response data and not user input +func ParseProductGroupIDInsensitively(input string) (*ProductGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + } + + return &id, nil +} + +// ValidateProductGroupID checks that 'input' can be parsed as a Product Group ID +func ValidateProductGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProductGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Product Group ID +func (id ProductGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/products/%s/groups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ProductId, id.GroupId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Product Group ID +func (id ProductGroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticProducts", "products", "products"), + resourceids.UserSpecifiedSegment("productId", "productIdValue"), + resourceids.StaticSegment("staticGroups", "groups", "groups"), + resourceids.UserSpecifiedSegment("groupId", "groupIdValue"), + } +} + +// String returns a human-readable description of this Product Group ID +func (id ProductGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Product: %q", id.ProductId), + fmt.Sprintf("Group: %q", id.GroupId), + } + return fmt.Sprintf("Product Group (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_checkentityexists.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_checkentityexists.go new file mode 100644 index 000000000000..fd90f4c41cf5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_checkentityexists.go @@ -0,0 +1,46 @@ +package productgroup + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckEntityExistsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CheckEntityExists ... +func (c ProductGroupClient) CheckEntityExists(ctx context.Context, id ProductGroupId) (result CheckEntityExistsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_createorupdate.go new file mode 100644 index 000000000000..20656a3ff19b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_createorupdate.go @@ -0,0 +1,52 @@ +package productgroup + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GroupContract +} + +// CreateOrUpdate ... +func (c ProductGroupClient) CreateOrUpdate(ctx context.Context, id ProductGroupId) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_delete.go new file mode 100644 index 000000000000..3f6b1c8820ef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_delete.go @@ -0,0 +1,47 @@ +package productgroup + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ProductGroupClient) Delete(ctx context.Context, id ProductGroupId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_listbyproduct.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_listbyproduct.go new file mode 100644 index 000000000000..483d84c6da7d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/method_listbyproduct.go @@ -0,0 +1,125 @@ +package productgroup + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GroupContract +} + +type ListByProductCompleteResult struct { + Items []GroupContract +} + +type ListByProductOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByProductOperationOptions() ListByProductOperationOptions { + return ListByProductOperationOptions{} +} + +func (o ListByProductOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByProductOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByProductOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByProduct ... +func (c ProductGroupClient) ListByProduct(ctx context.Context, id ProductId, options ListByProductOperationOptions) (result ListByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/groups", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GroupContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByProductComplete retrieves all the results into a single object +func (c ProductGroupClient) ListByProductComplete(ctx context.Context, id ProductId, options ListByProductOperationOptions) (ListByProductCompleteResult, error) { + return c.ListByProductCompleteMatchingPredicate(ctx, id, options, GroupContractOperationPredicate{}) +} + +// ListByProductCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductGroupClient) ListByProductCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListByProductOperationOptions, predicate GroupContractOperationPredicate) (result ListByProductCompleteResult, err error) { + items := make([]GroupContract, 0) + + resp, err := c.ListByProduct(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByProductCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/model_groupcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/model_groupcontract.go new file mode 100644 index 000000000000..e2c720afe0ca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/model_groupcontract.go @@ -0,0 +1,11 @@ +package productgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *GroupContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/model_groupcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/model_groupcontractproperties.go new file mode 100644 index 000000000000..f4dc5d956539 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/model_groupcontractproperties.go @@ -0,0 +1,12 @@ +package productgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupContractProperties struct { + BuiltIn *bool `json:"builtIn,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName string `json:"displayName"` + ExternalId *string `json:"externalId,omitempty"` + Type *GroupType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/predicates.go new file mode 100644 index 000000000000..6d25db13cf93 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/predicates.go @@ -0,0 +1,27 @@ +package productgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p GroupContractOperationPredicate) Matches(input GroupContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/version.go new file mode 100644 index 000000000000..47245ad69110 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup/version.go @@ -0,0 +1,12 @@ +package productgroup + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/productgroup/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/README.md new file mode 100644 index 000000000000..b3e0f23bda04 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/README.md @@ -0,0 +1,105 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy` Documentation + +The `productpolicy` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy" +``` + + +### Client Initialization + +```go +client := productpolicy.NewProductPolicyClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ProductPolicyClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := productpolicy.NewProductID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue") + +payload := productpolicy.PolicyContract{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, productpolicy.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductPolicyClient.Delete` + +```go +ctx := context.TODO() +id := productpolicy.NewProductID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue") + +read, err := client.Delete(ctx, id, productpolicy.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductPolicyClient.Get` + +```go +ctx := context.TODO() +id := productpolicy.NewProductID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue") + +read, err := client.Get(ctx, id, productpolicy.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductPolicyClient.GetEntityTag` + +```go +ctx := context.TODO() +id := productpolicy.NewProductID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductPolicyClient.ListByProduct` + +```go +ctx := context.TODO() +id := productpolicy.NewProductID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue") + +read, err := client.ListByProduct(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/client.go new file mode 100644 index 000000000000..e6887574aaad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/client.go @@ -0,0 +1,26 @@ +package productpolicy + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProductPolicyClient struct { + Client *resourcemanager.Client +} + +func NewProductPolicyClientWithBaseURI(sdkApi sdkEnv.Api) (*ProductPolicyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "productpolicy", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductPolicyClient: %+v", err) + } + + return &ProductPolicyClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/constants.go new file mode 100644 index 000000000000..196b57d596fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/constants.go @@ -0,0 +1,98 @@ +package productpolicy + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyContentFormat string + +const ( + PolicyContentFormatRawxml PolicyContentFormat = "rawxml" + PolicyContentFormatRawxmlNegativelink PolicyContentFormat = "rawxml-link" + PolicyContentFormatXml PolicyContentFormat = "xml" + PolicyContentFormatXmlNegativelink PolicyContentFormat = "xml-link" +) + +func PossibleValuesForPolicyContentFormat() []string { + return []string{ + string(PolicyContentFormatRawxml), + string(PolicyContentFormatRawxmlNegativelink), + string(PolicyContentFormatXml), + string(PolicyContentFormatXmlNegativelink), + } +} + +func (s *PolicyContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePolicyContentFormat(input string) (*PolicyContentFormat, error) { + vals := map[string]PolicyContentFormat{ + "rawxml": PolicyContentFormatRawxml, + "rawxml-link": PolicyContentFormatRawxmlNegativelink, + "xml": PolicyContentFormatXml, + "xml-link": PolicyContentFormatXmlNegativelink, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyContentFormat(input) + return &out, nil +} + +type PolicyExportFormat string + +const ( + PolicyExportFormatRawxml PolicyExportFormat = "rawxml" + PolicyExportFormatXml PolicyExportFormat = "xml" +) + +func PossibleValuesForPolicyExportFormat() []string { + return []string{ + string(PolicyExportFormatRawxml), + string(PolicyExportFormatXml), + } +} + +func (s *PolicyExportFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyExportFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePolicyExportFormat(input string) (*PolicyExportFormat, error) { + vals := map[string]PolicyExportFormat{ + "rawxml": PolicyExportFormatRawxml, + "xml": PolicyExportFormatXml, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyExportFormat(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/id_product.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/id_product.go new file mode 100644 index 000000000000..9698867e813c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/id_product.go @@ -0,0 +1,140 @@ +package productpolicy + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ProductId{} + +// ProductId is a struct representing the Resource ID for a Product +type ProductId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ProductId string +} + +// NewProductID returns a new ProductId struct +func NewProductID(subscriptionId string, resourceGroupName string, serviceName string, productId string) ProductId { + return ProductId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ProductId: productId, + } +} + +// ParseProductID parses 'input' into a ProductId +func ParseProductID(input string) (*ProductId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + return &id, nil +} + +// ParseProductIDInsensitively parses 'input' case-insensitively into a ProductId +// note: this method should only be used for API response data and not user input +func ParseProductIDInsensitively(input string) (*ProductId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + return &id, nil +} + +// ValidateProductID checks that 'input' can be parsed as a Product ID +func ValidateProductID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProductID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Product ID +func (id ProductId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/products/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ProductId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Product ID +func (id ProductId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticProducts", "products", "products"), + resourceids.UserSpecifiedSegment("productId", "productIdValue"), + } +} + +// String returns a human-readable description of this Product ID +func (id ProductId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Product: %q", id.ProductId), + } + return fmt.Sprintf("Product (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_createorupdate.go new file mode 100644 index 000000000000..0471e0e461fa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_createorupdate.go @@ -0,0 +1,85 @@ +package productpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ProductPolicyClient) CreateOrUpdate(ctx context.Context, id ProductId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_delete.go new file mode 100644 index 000000000000..09bc23bd22e4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_delete.go @@ -0,0 +1,76 @@ +package productpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ProductPolicyClient) Delete(ctx context.Context, id ProductId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_get.go new file mode 100644 index 000000000000..46284c64c327 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_get.go @@ -0,0 +1,80 @@ +package productpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type GetOperationOptions struct { + Format *PolicyExportFormat +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + return &out +} + +// Get ... +func (c ProductPolicyClient) Get(ctx context.Context, id ProductId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_getentitytag.go new file mode 100644 index 000000000000..3e3787982d69 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_getentitytag.go @@ -0,0 +1,47 @@ +package productpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ProductPolicyClient) GetEntityTag(ctx context.Context, id ProductId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_listbyproduct.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_listbyproduct.go new file mode 100644 index 000000000000..d9cbc9812e43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/method_listbyproduct.go @@ -0,0 +1,52 @@ +package productpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyCollection +} + +// ListByProduct ... +func (c ProductPolicyClient) ListByProduct(ctx context.Context, id ProductId) (result ListByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/model_policycollection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/model_policycollection.go new file mode 100644 index 000000000000..7d901d49e835 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/model_policycollection.go @@ -0,0 +1,10 @@ +package productpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyCollection struct { + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]PolicyContract `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/model_policycontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/model_policycontract.go new file mode 100644 index 000000000000..63e223631e81 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/model_policycontract.go @@ -0,0 +1,11 @@ +package productpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PolicyContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/model_policycontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/model_policycontractproperties.go new file mode 100644 index 000000000000..ac01100ffc11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/model_policycontractproperties.go @@ -0,0 +1,9 @@ +package productpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyContractProperties struct { + Format *PolicyContentFormat `json:"format,omitempty"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/version.go new file mode 100644 index 000000000000..941e3aed8cce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy/version.go @@ -0,0 +1,12 @@ +package productpolicy + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/productpolicy/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/README.md new file mode 100644 index 000000000000..7d1829116037 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/README.md @@ -0,0 +1,101 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag` Documentation + +The `producttag` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag" +``` + + +### Client Initialization + +```go +client := producttag.NewProductTagClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ProductTagClient.TagAssignToProduct` + +```go +ctx := context.TODO() +id := producttag.NewProductTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue", "tagIdValue") + +read, err := client.TagAssignToProduct(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductTagClient.TagDetachFromProduct` + +```go +ctx := context.TODO() +id := producttag.NewProductTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue", "tagIdValue") + +read, err := client.TagDetachFromProduct(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductTagClient.TagGetByProduct` + +```go +ctx := context.TODO() +id := producttag.NewProductTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue", "tagIdValue") + +read, err := client.TagGetByProduct(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductTagClient.TagGetEntityStateByProduct` + +```go +ctx := context.TODO() +id := producttag.NewProductTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue", "tagIdValue") + +read, err := client.TagGetEntityStateByProduct(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProductTagClient.TagListByProduct` + +```go +ctx := context.TODO() +id := producttag.NewProductID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "productIdValue") + +// alternatively `client.TagListByProduct(ctx, id, producttag.DefaultTagListByProductOperationOptions())` can be used to do batched pagination +items, err := client.TagListByProductComplete(ctx, id, producttag.DefaultTagListByProductOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/client.go new file mode 100644 index 000000000000..720b81ec2d88 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/client.go @@ -0,0 +1,26 @@ +package producttag + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProductTagClient struct { + Client *resourcemanager.Client +} + +func NewProductTagClientWithBaseURI(sdkApi sdkEnv.Api) (*ProductTagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "producttag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductTagClient: %+v", err) + } + + return &ProductTagClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/id_product.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/id_product.go new file mode 100644 index 000000000000..0e8b83b03ef6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/id_product.go @@ -0,0 +1,140 @@ +package producttag + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ProductId{} + +// ProductId is a struct representing the Resource ID for a Product +type ProductId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ProductId string +} + +// NewProductID returns a new ProductId struct +func NewProductID(subscriptionId string, resourceGroupName string, serviceName string, productId string) ProductId { + return ProductId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ProductId: productId, + } +} + +// ParseProductID parses 'input' into a ProductId +func ParseProductID(input string) (*ProductId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + return &id, nil +} + +// ParseProductIDInsensitively parses 'input' case-insensitively into a ProductId +// note: this method should only be used for API response data and not user input +func ParseProductIDInsensitively(input string) (*ProductId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + return &id, nil +} + +// ValidateProductID checks that 'input' can be parsed as a Product ID +func ValidateProductID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProductID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Product ID +func (id ProductId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/products/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ProductId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Product ID +func (id ProductId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticProducts", "products", "products"), + resourceids.UserSpecifiedSegment("productId", "productIdValue"), + } +} + +// String returns a human-readable description of this Product ID +func (id ProductId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Product: %q", id.ProductId), + } + return fmt.Sprintf("Product (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/id_producttag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/id_producttag.go new file mode 100644 index 000000000000..ee2cbe499a32 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/id_producttag.go @@ -0,0 +1,153 @@ +package producttag + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ProductTagId{} + +// ProductTagId is a struct representing the Resource ID for a Product Tag +type ProductTagId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ProductId string + TagId string +} + +// NewProductTagID returns a new ProductTagId struct +func NewProductTagID(subscriptionId string, resourceGroupName string, serviceName string, productId string, tagId string) ProductTagId { + return ProductTagId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ProductId: productId, + TagId: tagId, + } +} + +// ParseProductTagID parses 'input' into a ProductTagId +func ParseProductTagID(input string) (*ProductTagId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductTagId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductTagId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + if id.TagId, ok = parsed.Parsed["tagId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + } + + return &id, nil +} + +// ParseProductTagIDInsensitively parses 'input' case-insensitively into a ProductTagId +// note: this method should only be used for API response data and not user input +func ParseProductTagIDInsensitively(input string) (*ProductTagId, error) { + parser := resourceids.NewParserFromResourceIdType(ProductTagId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProductTagId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.ProductId, ok = parsed.Parsed["productId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + } + + if id.TagId, ok = parsed.Parsed["tagId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + } + + return &id, nil +} + +// ValidateProductTagID checks that 'input' can be parsed as a Product Tag ID +func ValidateProductTagID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProductTagID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Product Tag ID +func (id ProductTagId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/products/%s/tags/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ProductId, id.TagId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Product Tag ID +func (id ProductTagId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticProducts", "products", "products"), + resourceids.UserSpecifiedSegment("productId", "productIdValue"), + resourceids.StaticSegment("staticTags", "tags", "tags"), + resourceids.UserSpecifiedSegment("tagId", "tagIdValue"), + } +} + +// String returns a human-readable description of this Product Tag ID +func (id ProductTagId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Product: %q", id.ProductId), + fmt.Sprintf("Tag: %q", id.TagId), + } + return fmt.Sprintf("Product Tag (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_tagassigntoproduct.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_tagassigntoproduct.go new file mode 100644 index 000000000000..55885dbd9354 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_tagassigntoproduct.go @@ -0,0 +1,52 @@ +package producttag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagAssignToProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagAssignToProduct ... +func (c ProductTagClient) TagAssignToProduct(ctx context.Context, id ProductTagId) (result TagAssignToProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_tagdetachfromproduct.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_tagdetachfromproduct.go new file mode 100644 index 000000000000..9564ceb67e11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_tagdetachfromproduct.go @@ -0,0 +1,47 @@ +package producttag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagDetachFromProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagDetachFromProduct ... +func (c ProductTagClient) TagDetachFromProduct(ctx context.Context, id ProductTagId) (result TagDetachFromProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_taggetbyproduct.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_taggetbyproduct.go new file mode 100644 index 000000000000..413a4b52b72e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_taggetbyproduct.go @@ -0,0 +1,51 @@ +package producttag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagGetByProduct ... +func (c ProductTagClient) TagGetByProduct(ctx context.Context, id ProductTagId) (result TagGetByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_taggetentitystatebyproduct.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_taggetentitystatebyproduct.go new file mode 100644 index 000000000000..8f0230094062 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_taggetentitystatebyproduct.go @@ -0,0 +1,46 @@ +package producttag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetEntityStateByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagGetEntityStateByProduct ... +func (c ProductTagClient) TagGetEntityStateByProduct(ctx context.Context, id ProductTagId) (result TagGetEntityStateByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_taglistbyproduct.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_taglistbyproduct.go new file mode 100644 index 000000000000..0b73c472a258 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/method_taglistbyproduct.go @@ -0,0 +1,125 @@ +package producttag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagListByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagContract +} + +type TagListByProductCompleteResult struct { + Items []TagContract +} + +type TagListByProductOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultTagListByProductOperationOptions() TagListByProductOperationOptions { + return TagListByProductOperationOptions{} +} + +func (o TagListByProductOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o TagListByProductOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o TagListByProductOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// TagListByProduct ... +func (c ProductTagClient) TagListByProduct(ctx context.Context, id ProductId, options TagListByProductOperationOptions) (result TagListByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// TagListByProductComplete retrieves all the results into a single object +func (c ProductTagClient) TagListByProductComplete(ctx context.Context, id ProductId, options TagListByProductOperationOptions) (TagListByProductCompleteResult, error) { + return c.TagListByProductCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) +} + +// TagListByProductCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductTagClient) TagListByProductCompleteMatchingPredicate(ctx context.Context, id ProductId, options TagListByProductOperationOptions, predicate TagContractOperationPredicate) (result TagListByProductCompleteResult, err error) { + items := make([]TagContract, 0) + + resp, err := c.TagListByProduct(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = TagListByProductCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/model_tagcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/model_tagcontract.go new file mode 100644 index 000000000000..8dbd2dfbb6fe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/model_tagcontract.go @@ -0,0 +1,11 @@ +package producttag + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *TagContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/model_tagcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/model_tagcontractproperties.go new file mode 100644 index 000000000000..02f03d01fa33 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/model_tagcontractproperties.go @@ -0,0 +1,8 @@ +package producttag + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagContractProperties struct { + DisplayName string `json:"displayName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/predicates.go new file mode 100644 index 000000000000..cc40ebaa06a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/predicates.go @@ -0,0 +1,27 @@ +package producttag + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p TagContractOperationPredicate) Matches(input TagContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/version.go new file mode 100644 index 000000000000..67e3e636b732 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag/version.go @@ -0,0 +1,12 @@ +package producttag + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/producttag/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/README.md new file mode 100644 index 000000000000..36d5ed43ef30 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/README.md @@ -0,0 +1,94 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings` Documentation + +The `signinsettings` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings" +``` + + +### Client Initialization + +```go +client := signinsettings.NewSignInSettingsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SignInSettingsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := signinsettings.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +payload := signinsettings.PortalSigninSettings{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, signinsettings.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignInSettingsClient.Get` + +```go +ctx := context.TODO() +id := signinsettings.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignInSettingsClient.GetEntityTag` + +```go +ctx := context.TODO() +id := signinsettings.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignInSettingsClient.Update` + +```go +ctx := context.TODO() +id := signinsettings.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +payload := signinsettings.PortalSigninSettings{ + // ... +} + + +read, err := client.Update(ctx, id, payload, signinsettings.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/client.go new file mode 100644 index 000000000000..a21dfcdddd25 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/client.go @@ -0,0 +1,26 @@ +package signinsettings + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SignInSettingsClient struct { + Client *resourcemanager.Client +} + +func NewSignInSettingsClientWithBaseURI(sdkApi sdkEnv.Api) (*SignInSettingsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "signinsettings", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SignInSettingsClient: %+v", err) + } + + return &SignInSettingsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/id_service.go new file mode 100644 index 000000000000..91fdf5b67b13 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/id_service.go @@ -0,0 +1,127 @@ +package signinsettings + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_createorupdate.go new file mode 100644 index 000000000000..7b9767c2fbe0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_createorupdate.go @@ -0,0 +1,84 @@ +package signinsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSigninSettings +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c SignInSettingsClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PortalSigninSettings, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/portalsettings/signin", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_get.go new file mode 100644 index 000000000000..173524f6cc76 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_get.go @@ -0,0 +1,52 @@ +package signinsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSigninSettings +} + +// Get ... +func (c SignInSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/portalsettings/signin", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_getentitytag.go new file mode 100644 index 000000000000..25861ccf2a4e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_getentitytag.go @@ -0,0 +1,47 @@ +package signinsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c SignInSettingsClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/portalsettings/signin", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_update.go new file mode 100644 index 000000000000..cdef3702ed0a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/method_update.go @@ -0,0 +1,79 @@ +package signinsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c SignInSettingsClient) Update(ctx context.Context, id ServiceId, input PortalSigninSettings, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/portalsettings/signin", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/model_portalsigninsettingproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/model_portalsigninsettingproperties.go new file mode 100644 index 000000000000..c97ccbce5c63 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/model_portalsigninsettingproperties.go @@ -0,0 +1,8 @@ +package signinsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PortalSigninSettingProperties struct { + Enabled *bool `json:"enabled,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/model_portalsigninsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/model_portalsigninsettings.go new file mode 100644 index 000000000000..cb7c961c1cf4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/model_portalsigninsettings.go @@ -0,0 +1,11 @@ +package signinsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PortalSigninSettings struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PortalSigninSettingProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/version.go new file mode 100644 index 000000000000..02197ac3720d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings/version.go @@ -0,0 +1,12 @@ +package signinsettings + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/signinsettings/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/README.md new file mode 100644 index 000000000000..a7a3186b4ca0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/README.md @@ -0,0 +1,94 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings` Documentation + +The `signupsettings` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings" +``` + + +### Client Initialization + +```go +client := signupsettings.NewSignUpSettingsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SignUpSettingsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := signupsettings.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +payload := signupsettings.PortalSignupSettings{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, signupsettings.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignUpSettingsClient.Get` + +```go +ctx := context.TODO() +id := signupsettings.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignUpSettingsClient.GetEntityTag` + +```go +ctx := context.TODO() +id := signupsettings.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignUpSettingsClient.Update` + +```go +ctx := context.TODO() +id := signupsettings.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +payload := signupsettings.PortalSignupSettings{ + // ... +} + + +read, err := client.Update(ctx, id, payload, signupsettings.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/client.go new file mode 100644 index 000000000000..2d9452823e32 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/client.go @@ -0,0 +1,26 @@ +package signupsettings + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SignUpSettingsClient struct { + Client *resourcemanager.Client +} + +func NewSignUpSettingsClientWithBaseURI(sdkApi sdkEnv.Api) (*SignUpSettingsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "signupsettings", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SignUpSettingsClient: %+v", err) + } + + return &SignUpSettingsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/id_service.go new file mode 100644 index 000000000000..5d9bd0a0c2f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/id_service.go @@ -0,0 +1,127 @@ +package signupsettings + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_createorupdate.go new file mode 100644 index 000000000000..7269ad66a33d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_createorupdate.go @@ -0,0 +1,84 @@ +package signupsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSignupSettings +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c SignUpSettingsClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PortalSignupSettings, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/portalsettings/signup", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_get.go new file mode 100644 index 000000000000..9c83e5e83ecb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_get.go @@ -0,0 +1,52 @@ +package signupsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSignupSettings +} + +// Get ... +func (c SignUpSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/portalsettings/signup", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_getentitytag.go new file mode 100644 index 000000000000..c664f2c2ea81 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_getentitytag.go @@ -0,0 +1,47 @@ +package signupsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c SignUpSettingsClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/portalsettings/signup", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_update.go new file mode 100644 index 000000000000..fd56de21870a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/method_update.go @@ -0,0 +1,79 @@ +package signupsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c SignUpSettingsClient) Update(ctx context.Context, id ServiceId, input PortalSignupSettings, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/portalsettings/signup", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/model_portalsignupsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/model_portalsignupsettings.go new file mode 100644 index 000000000000..9519f3132c96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/model_portalsignupsettings.go @@ -0,0 +1,11 @@ +package signupsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PortalSignupSettings struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PortalSignupSettingsProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/model_portalsignupsettingsproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/model_portalsignupsettingsproperties.go new file mode 100644 index 000000000000..f011af153f8f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/model_portalsignupsettingsproperties.go @@ -0,0 +1,9 @@ +package signupsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PortalSignupSettingsProperties struct { + Enabled *bool `json:"enabled,omitempty"` + TermsOfService *TermsOfServiceProperties `json:"termsOfService,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/model_termsofserviceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/model_termsofserviceproperties.go new file mode 100644 index 000000000000..13c71bb8ee46 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/model_termsofserviceproperties.go @@ -0,0 +1,10 @@ +package signupsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TermsOfServiceProperties struct { + ConsentRequired *bool `json:"consentRequired,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Text *string `json:"text,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/version.go new file mode 100644 index 000000000000..376d7c136c15 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings/version.go @@ -0,0 +1,12 @@ +package signupsettings + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/signupsettings/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/README.md new file mode 100644 index 000000000000..2c63d8c39030 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/README.md @@ -0,0 +1,191 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription` Documentation + +The `subscription` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription" +``` + + +### Client Initialization + +```go +client := subscription.NewSubscriptionClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SubscriptionClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := subscription.NewSubscriptions2ID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "subscriptionValue") + +payload := subscription.SubscriptionCreateParameters{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, subscription.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SubscriptionClient.Delete` + +```go +ctx := context.TODO() +id := subscription.NewSubscriptions2ID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "subscriptionValue") + +read, err := client.Delete(ctx, id, subscription.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SubscriptionClient.Get` + +```go +ctx := context.TODO() +id := subscription.NewSubscriptions2ID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "subscriptionValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SubscriptionClient.GetEntityTag` + +```go +ctx := context.TODO() +id := subscription.NewSubscriptions2ID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "subscriptionValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SubscriptionClient.List` + +```go +ctx := context.TODO() +id := subscription.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.List(ctx, id, subscription.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, subscription.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SubscriptionClient.ListSecrets` + +```go +ctx := context.TODO() +id := subscription.NewSubscriptions2ID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "subscriptionValue") + +read, err := client.ListSecrets(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SubscriptionClient.RegeneratePrimaryKey` + +```go +ctx := context.TODO() +id := subscription.NewSubscriptions2ID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "subscriptionValue") + +read, err := client.RegeneratePrimaryKey(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SubscriptionClient.RegenerateSecondaryKey` + +```go +ctx := context.TODO() +id := subscription.NewSubscriptions2ID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "subscriptionValue") + +read, err := client.RegenerateSecondaryKey(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SubscriptionClient.Update` + +```go +ctx := context.TODO() +id := subscription.NewSubscriptions2ID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "subscriptionValue") + +payload := subscription.SubscriptionUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload, subscription.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SubscriptionClient.UserSubscriptionGet` + +```go +ctx := context.TODO() +id := subscription.NewUserSubscriptions2ID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "userIdValue", "subscriptionValue") + +read, err := client.UserSubscriptionGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/client.go new file mode 100644 index 000000000000..9885434f9ddf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/client.go @@ -0,0 +1,26 @@ +package subscription + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionClient struct { + Client *resourcemanager.Client +} + +func NewSubscriptionClientWithBaseURI(sdkApi sdkEnv.Api) (*SubscriptionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "subscription", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SubscriptionClient: %+v", err) + } + + return &SubscriptionClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/constants.go new file mode 100644 index 000000000000..71ac415eaca7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/constants.go @@ -0,0 +1,104 @@ +package subscription + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AppType string + +const ( + AppTypeDeveloperPortal AppType = "developerPortal" + AppTypePortal AppType = "portal" +) + +func PossibleValuesForAppType() []string { + return []string{ + string(AppTypeDeveloperPortal), + string(AppTypePortal), + } +} + +func (s *AppType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAppType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAppType(input string) (*AppType, error) { + vals := map[string]AppType{ + "developerportal": AppTypeDeveloperPortal, + "portal": AppTypePortal, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AppType(input) + return &out, nil +} + +type SubscriptionState string + +const ( + SubscriptionStateActive SubscriptionState = "active" + SubscriptionStateCancelled SubscriptionState = "cancelled" + SubscriptionStateExpired SubscriptionState = "expired" + SubscriptionStateRejected SubscriptionState = "rejected" + SubscriptionStateSubmitted SubscriptionState = "submitted" + SubscriptionStateSuspended SubscriptionState = "suspended" +) + +func PossibleValuesForSubscriptionState() []string { + return []string{ + string(SubscriptionStateActive), + string(SubscriptionStateCancelled), + string(SubscriptionStateExpired), + string(SubscriptionStateRejected), + string(SubscriptionStateSubmitted), + string(SubscriptionStateSuspended), + } +} + +func (s *SubscriptionState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSubscriptionState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSubscriptionState(input string) (*SubscriptionState, error) { + vals := map[string]SubscriptionState{ + "active": SubscriptionStateActive, + "cancelled": SubscriptionStateCancelled, + "expired": SubscriptionStateExpired, + "rejected": SubscriptionStateRejected, + "submitted": SubscriptionStateSubmitted, + "suspended": SubscriptionStateSuspended, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SubscriptionState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/id_service.go new file mode 100644 index 000000000000..ec7f310e3df7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/id_service.go @@ -0,0 +1,127 @@ +package subscription + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/id_subscriptions2.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/id_subscriptions2.go new file mode 100644 index 000000000000..baa1f57e1f6e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/id_subscriptions2.go @@ -0,0 +1,140 @@ +package subscription + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = Subscriptions2Id{} + +// Subscriptions2Id is a struct representing the Resource ID for a Subscriptions 2 +type Subscriptions2Id struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + SubscriptionName string +} + +// NewSubscriptions2ID returns a new Subscriptions2Id struct +func NewSubscriptions2ID(subscriptionId string, resourceGroupName string, serviceName string, subscriptionName string) Subscriptions2Id { + return Subscriptions2Id{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + SubscriptionName: subscriptionName, + } +} + +// ParseSubscriptions2ID parses 'input' into a Subscriptions2Id +func ParseSubscriptions2ID(input string) (*Subscriptions2Id, error) { + parser := resourceids.NewParserFromResourceIdType(Subscriptions2Id{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := Subscriptions2Id{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + } + + return &id, nil +} + +// ParseSubscriptions2IDInsensitively parses 'input' case-insensitively into a Subscriptions2Id +// note: this method should only be used for API response data and not user input +func ParseSubscriptions2IDInsensitively(input string) (*Subscriptions2Id, error) { + parser := resourceids.NewParserFromResourceIdType(Subscriptions2Id{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := Subscriptions2Id{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + } + + return &id, nil +} + +// ValidateSubscriptions2ID checks that 'input' can be parsed as a Subscriptions 2 ID +func ValidateSubscriptions2ID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSubscriptions2ID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Subscriptions 2 ID +func (id Subscriptions2Id) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/subscriptions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.SubscriptionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Subscriptions 2 ID +func (id Subscriptions2Id) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticSubscriptions2", "subscriptions", "subscriptions"), + resourceids.UserSpecifiedSegment("subscriptionName", "subscriptionValue"), + } +} + +// String returns a human-readable description of this Subscriptions 2 ID +func (id Subscriptions2Id) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Subscription Name: %q", id.SubscriptionName), + } + return fmt.Sprintf("Subscriptions 2 (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/id_usersubscriptions2.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/id_usersubscriptions2.go new file mode 100644 index 000000000000..ccc3bc6c72a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/id_usersubscriptions2.go @@ -0,0 +1,153 @@ +package subscription + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = UserSubscriptions2Id{} + +// UserSubscriptions2Id is a struct representing the Resource ID for a User Subscriptions 2 +type UserSubscriptions2Id struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + UserId string + SubscriptionName string +} + +// NewUserSubscriptions2ID returns a new UserSubscriptions2Id struct +func NewUserSubscriptions2ID(subscriptionId string, resourceGroupName string, serviceName string, userId string, subscriptionName string) UserSubscriptions2Id { + return UserSubscriptions2Id{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + UserId: userId, + SubscriptionName: subscriptionName, + } +} + +// ParseUserSubscriptions2ID parses 'input' into a UserSubscriptions2Id +func ParseUserSubscriptions2ID(input string) (*UserSubscriptions2Id, error) { + parser := resourceids.NewParserFromResourceIdType(UserSubscriptions2Id{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := UserSubscriptions2Id{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.UserId, ok = parsed.Parsed["userId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + } + + if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + } + + return &id, nil +} + +// ParseUserSubscriptions2IDInsensitively parses 'input' case-insensitively into a UserSubscriptions2Id +// note: this method should only be used for API response data and not user input +func ParseUserSubscriptions2IDInsensitively(input string) (*UserSubscriptions2Id, error) { + parser := resourceids.NewParserFromResourceIdType(UserSubscriptions2Id{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := UserSubscriptions2Id{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.UserId, ok = parsed.Parsed["userId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + } + + if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + } + + return &id, nil +} + +// ValidateUserSubscriptions2ID checks that 'input' can be parsed as a User Subscriptions 2 ID +func ValidateUserSubscriptions2ID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseUserSubscriptions2ID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted User Subscriptions 2 ID +func (id UserSubscriptions2Id) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/users/%s/subscriptions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.UserId, id.SubscriptionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this User Subscriptions 2 ID +func (id UserSubscriptions2Id) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticUsers", "users", "users"), + resourceids.UserSpecifiedSegment("userId", "userIdValue"), + resourceids.StaticSegment("staticSubscriptions2", "subscriptions", "subscriptions"), + resourceids.UserSpecifiedSegment("subscriptionName", "subscriptionValue"), + } +} + +// String returns a human-readable description of this User Subscriptions 2 ID +func (id UserSubscriptions2Id) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("User: %q", id.UserId), + fmt.Sprintf("Subscription Name: %q", id.SubscriptionName), + } + return fmt.Sprintf("User Subscriptions 2 (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_createorupdate.go new file mode 100644 index 000000000000..d69e1efca03b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_createorupdate.go @@ -0,0 +1,92 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SubscriptionContract +} + +type CreateOrUpdateOperationOptions struct { + AppType *AppType + IfMatch *string + Notify *bool +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.AppType != nil { + out.Append("appType", fmt.Sprintf("%v", *o.AppType)) + } + if o.Notify != nil { + out.Append("notify", fmt.Sprintf("%v", *o.Notify)) + } + return &out +} + +// CreateOrUpdate ... +func (c SubscriptionClient) CreateOrUpdate(ctx context.Context, id Subscriptions2Id, input SubscriptionCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_delete.go new file mode 100644 index 000000000000..a14c0ad04e12 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_delete.go @@ -0,0 +1,76 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c SubscriptionClient) Delete(ctx context.Context, id Subscriptions2Id, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_get.go new file mode 100644 index 000000000000..8aabef6e59e5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_get.go @@ -0,0 +1,51 @@ +package subscription + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SubscriptionContract +} + +// Get ... +func (c SubscriptionClient) Get(ctx context.Context, id Subscriptions2Id) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_getentitytag.go new file mode 100644 index 000000000000..70173b87ce1b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_getentitytag.go @@ -0,0 +1,46 @@ +package subscription + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c SubscriptionClient) GetEntityTag(ctx context.Context, id Subscriptions2Id) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_list.go new file mode 100644 index 000000000000..5a583cace4b6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_list.go @@ -0,0 +1,125 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SubscriptionContract +} + +type ListCompleteResult struct { + Items []SubscriptionContract +} + +type ListOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// List ... +func (c SubscriptionClient) List(ctx context.Context, id ServiceId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/subscriptions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SubscriptionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c SubscriptionClient) ListComplete(ctx context.Context, id ServiceId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, SubscriptionContractOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SubscriptionClient) ListCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListOperationOptions, predicate SubscriptionContractOperationPredicate) (result ListCompleteResult, err error) { + items := make([]SubscriptionContract, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_listsecrets.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_listsecrets.go new file mode 100644 index 000000000000..f204e4579409 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_listsecrets.go @@ -0,0 +1,52 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SubscriptionKeysContract +} + +// ListSecrets ... +func (c SubscriptionClient) ListSecrets(ctx context.Context, id Subscriptions2Id) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_regenerateprimarykey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_regenerateprimarykey.go new file mode 100644 index 000000000000..d2ae52bbb7c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_regenerateprimarykey.go @@ -0,0 +1,47 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegeneratePrimaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegeneratePrimaryKey ... +func (c SubscriptionClient) RegeneratePrimaryKey(ctx context.Context, id Subscriptions2Id) (result RegeneratePrimaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regeneratePrimaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_regeneratesecondarykey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_regeneratesecondarykey.go new file mode 100644 index 000000000000..7e3998ced00f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_regeneratesecondarykey.go @@ -0,0 +1,47 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateSecondaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegenerateSecondaryKey ... +func (c SubscriptionClient) RegenerateSecondaryKey(ctx context.Context, id Subscriptions2Id) (result RegenerateSecondaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regenerateSecondaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_update.go new file mode 100644 index 000000000000..f01dc48db341 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_update.go @@ -0,0 +1,91 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SubscriptionContract +} + +type UpdateOperationOptions struct { + AppType *AppType + IfMatch *string + Notify *bool +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.AppType != nil { + out.Append("appType", fmt.Sprintf("%v", *o.AppType)) + } + if o.Notify != nil { + out.Append("notify", fmt.Sprintf("%v", *o.Notify)) + } + return &out +} + +// Update ... +func (c SubscriptionClient) Update(ctx context.Context, id Subscriptions2Id, input SubscriptionUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_usersubscriptionget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_usersubscriptionget.go new file mode 100644 index 000000000000..7553f7391d9f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/method_usersubscriptionget.go @@ -0,0 +1,51 @@ +package subscription + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserSubscriptionGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SubscriptionContract +} + +// UserSubscriptionGet ... +func (c SubscriptionClient) UserSubscriptionGet(ctx context.Context, id UserSubscriptions2Id) (result UserSubscriptionGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncontract.go new file mode 100644 index 000000000000..ab731cdb9cbe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncontract.go @@ -0,0 +1,11 @@ +package subscription + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SubscriptionContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncontractproperties.go new file mode 100644 index 000000000000..dfe4f8584c0f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncontractproperties.go @@ -0,0 +1,86 @@ +package subscription + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionContractProperties struct { + AllowTracing *bool `json:"allowTracing,omitempty"` + CreatedDate *string `json:"createdDate,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + EndDate *string `json:"endDate,omitempty"` + ExpirationDate *string `json:"expirationDate,omitempty"` + NotificationDate *string `json:"notificationDate,omitempty"` + OwnerId *string `json:"ownerId,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + Scope string `json:"scope"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + StartDate *string `json:"startDate,omitempty"` + State SubscriptionState `json:"state"` + StateComment *string `json:"stateComment,omitempty"` +} + +func (o *SubscriptionContractProperties) GetCreatedDateAsTime() (*time.Time, error) { + if o.CreatedDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *SubscriptionContractProperties) SetCreatedDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedDate = &formatted +} + +func (o *SubscriptionContractProperties) GetEndDateAsTime() (*time.Time, error) { + if o.EndDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *SubscriptionContractProperties) SetEndDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndDate = &formatted +} + +func (o *SubscriptionContractProperties) GetExpirationDateAsTime() (*time.Time, error) { + if o.ExpirationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ExpirationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *SubscriptionContractProperties) SetExpirationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationDate = &formatted +} + +func (o *SubscriptionContractProperties) GetNotificationDateAsTime() (*time.Time, error) { + if o.NotificationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NotificationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *SubscriptionContractProperties) SetNotificationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NotificationDate = &formatted +} + +func (o *SubscriptionContractProperties) GetStartDateAsTime() (*time.Time, error) { + if o.StartDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *SubscriptionContractProperties) SetStartDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncreateparameterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncreateparameterproperties.go new file mode 100644 index 000000000000..2ac36f98e30b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncreateparameterproperties.go @@ -0,0 +1,14 @@ +package subscription + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionCreateParameterProperties struct { + AllowTracing *bool `json:"allowTracing,omitempty"` + DisplayName string `json:"displayName"` + OwnerId *string `json:"ownerId,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + Scope string `json:"scope"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + State *SubscriptionState `json:"state,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncreateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncreateparameters.go new file mode 100644 index 000000000000..a2f57c3b4a4a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptioncreateparameters.go @@ -0,0 +1,8 @@ +package subscription + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionCreateParameters struct { + Properties *SubscriptionCreateParameterProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptionkeyscontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptionkeyscontract.go new file mode 100644 index 000000000000..93de07ed1277 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptionkeyscontract.go @@ -0,0 +1,9 @@ +package subscription + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionKeysContract struct { + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptionupdateparameterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptionupdateparameterproperties.go new file mode 100644 index 000000000000..7e4602c3021d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptionupdateparameterproperties.go @@ -0,0 +1,34 @@ +package subscription + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionUpdateParameterProperties struct { + AllowTracing *bool `json:"allowTracing,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + ExpirationDate *string `json:"expirationDate,omitempty"` + OwnerId *string `json:"ownerId,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + Scope *string `json:"scope,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + State *SubscriptionState `json:"state,omitempty"` + StateComment *string `json:"stateComment,omitempty"` +} + +func (o *SubscriptionUpdateParameterProperties) GetExpirationDateAsTime() (*time.Time, error) { + if o.ExpirationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ExpirationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *SubscriptionUpdateParameterProperties) SetExpirationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptionupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptionupdateparameters.go new file mode 100644 index 000000000000..e4a2d381d4b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/model_subscriptionupdateparameters.go @@ -0,0 +1,8 @@ +package subscription + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionUpdateParameters struct { + Properties *SubscriptionUpdateParameterProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/predicates.go new file mode 100644 index 000000000000..71fb75412ad5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/predicates.go @@ -0,0 +1,27 @@ +package subscription + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SubscriptionContractOperationPredicate) Matches(input SubscriptionContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/version.go new file mode 100644 index 000000000000..f0723f37a811 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription/version.go @@ -0,0 +1,12 @@ +package subscription + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/subscription/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/README.md new file mode 100644 index 000000000000..79e3819bce72 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag` Documentation + +The `tag` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag" +``` + + +### Client Initialization + +```go +client := tag.NewTagClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `TagClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := tag.NewTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "tagIdValue") + +payload := tag.TagCreateUpdateParameters{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, tag.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TagClient.Delete` + +```go +ctx := context.TODO() +id := tag.NewTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "tagIdValue") + +read, err := client.Delete(ctx, id, tag.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TagClient.Get` + +```go +ctx := context.TODO() +id := tag.NewTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "tagIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TagClient.GetEntityState` + +```go +ctx := context.TODO() +id := tag.NewTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "tagIdValue") + +read, err := client.GetEntityState(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TagClient.ListByService` + +```go +ctx := context.TODO() +id := tag.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, tag.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, tag.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `TagClient.Update` + +```go +ctx := context.TODO() +id := tag.NewTagID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "tagIdValue") + +payload := tag.TagCreateUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload, tag.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/client.go new file mode 100644 index 000000000000..e97e5adc95e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/client.go @@ -0,0 +1,26 @@ +package tag + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagClient struct { + Client *resourcemanager.Client +} + +func NewTagClientWithBaseURI(sdkApi sdkEnv.Api) (*TagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "tag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TagClient: %+v", err) + } + + return &TagClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/id_service.go new file mode 100644 index 000000000000..05b834b495eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/id_service.go @@ -0,0 +1,127 @@ +package tag + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/id_tag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/id_tag.go new file mode 100644 index 000000000000..2f3b0e3027e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/id_tag.go @@ -0,0 +1,140 @@ +package tag + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = TagId{} + +// TagId is a struct representing the Resource ID for a Tag +type TagId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + TagId string +} + +// NewTagID returns a new TagId struct +func NewTagID(subscriptionId string, resourceGroupName string, serviceName string, tagId string) TagId { + return TagId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + TagId: tagId, + } +} + +// ParseTagID parses 'input' into a TagId +func ParseTagID(input string) (*TagId, error) { + parser := resourceids.NewParserFromResourceIdType(TagId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TagId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.TagId, ok = parsed.Parsed["tagId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + } + + return &id, nil +} + +// ParseTagIDInsensitively parses 'input' case-insensitively into a TagId +// note: this method should only be used for API response data and not user input +func ParseTagIDInsensitively(input string) (*TagId, error) { + parser := resourceids.NewParserFromResourceIdType(TagId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TagId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.TagId, ok = parsed.Parsed["tagId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + } + + return &id, nil +} + +// ValidateTagID checks that 'input' can be parsed as a Tag ID +func ValidateTagID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseTagID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Tag ID +func (id TagId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/tags/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.TagId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Tag ID +func (id TagId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticTags", "tags", "tags"), + resourceids.UserSpecifiedSegment("tagId", "tagIdValue"), + } +} + +// String returns a human-readable description of this Tag ID +func (id TagId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Tag: %q", id.TagId), + } + return fmt.Sprintf("Tag (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_createorupdate.go new file mode 100644 index 000000000000..b7c955b44801 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_createorupdate.go @@ -0,0 +1,85 @@ +package tag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c TagClient) CreateOrUpdate(ctx context.Context, id TagId, input TagCreateUpdateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_delete.go new file mode 100644 index 000000000000..01b721284711 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_delete.go @@ -0,0 +1,76 @@ +package tag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c TagClient) Delete(ctx context.Context, id TagId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_get.go new file mode 100644 index 000000000000..340922be21e5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_get.go @@ -0,0 +1,51 @@ +package tag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// Get ... +func (c TagClient) Get(ctx context.Context, id TagId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_getentitystate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_getentitystate.go new file mode 100644 index 000000000000..b56c0026a999 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_getentitystate.go @@ -0,0 +1,46 @@ +package tag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityStateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityState ... +func (c TagClient) GetEntityState(ctx context.Context, id TagId) (result GetEntityStateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_listbyservice.go new file mode 100644 index 000000000000..110e8d13d3c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_listbyservice.go @@ -0,0 +1,129 @@ +package tag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagContract +} + +type ListByServiceCompleteResult struct { + Items []TagContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Scope *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Scope != nil { + out.Append("scope", fmt.Sprintf("%v", *o.Scope)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c TagClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c TagClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TagClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate TagContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]TagContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_update.go new file mode 100644 index 000000000000..a301e0541378 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/method_update.go @@ -0,0 +1,84 @@ +package tag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c TagClient) Update(ctx context.Context, id TagId, input TagCreateUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/model_tagcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/model_tagcontract.go new file mode 100644 index 000000000000..9103d40ca711 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/model_tagcontract.go @@ -0,0 +1,11 @@ +package tag + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *TagContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/model_tagcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/model_tagcontractproperties.go new file mode 100644 index 000000000000..6cd5b7a2218a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/model_tagcontractproperties.go @@ -0,0 +1,8 @@ +package tag + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagContractProperties struct { + DisplayName string `json:"displayName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/model_tagcreateupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/model_tagcreateupdateparameters.go new file mode 100644 index 000000000000..0169b289eb8b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/model_tagcreateupdateparameters.go @@ -0,0 +1,8 @@ +package tag + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagCreateUpdateParameters struct { + Properties *TagContractProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/predicates.go new file mode 100644 index 000000000000..b05086d88d16 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/predicates.go @@ -0,0 +1,27 @@ +package tag + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p TagContractOperationPredicate) Matches(input TagContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/version.go new file mode 100644 index 000000000000..335211bec208 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag/version.go @@ -0,0 +1,12 @@ +package tag + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/tag/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/README.md new file mode 100644 index 000000000000..5bc3aebbecc3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/README.md @@ -0,0 +1,159 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess` Documentation + +The `tenantaccess` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess" +``` + + +### Client Initialization + +```go +client := tenantaccess.NewTenantAccessClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `TenantAccessClient.Create` + +```go +ctx := context.TODO() +id := tenantaccess.NewAccessID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "access") + +payload := tenantaccess.AccessInformationCreateParameters{ + // ... +} + + +read, err := client.Create(ctx, id, payload, tenantaccess.DefaultCreateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TenantAccessClient.Get` + +```go +ctx := context.TODO() +id := tenantaccess.NewAccessID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "access") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TenantAccessClient.GetEntityTag` + +```go +ctx := context.TODO() +id := tenantaccess.NewAccessID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "access") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TenantAccessClient.ListByService` + +```go +ctx := context.TODO() +id := tenantaccess.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, tenantaccess.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, tenantaccess.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `TenantAccessClient.ListSecrets` + +```go +ctx := context.TODO() +id := tenantaccess.NewAccessID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "access") + +read, err := client.ListSecrets(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TenantAccessClient.RegeneratePrimaryKey` + +```go +ctx := context.TODO() +id := tenantaccess.NewAccessID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "access") + +read, err := client.RegeneratePrimaryKey(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TenantAccessClient.RegenerateSecondaryKey` + +```go +ctx := context.TODO() +id := tenantaccess.NewAccessID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "access") + +read, err := client.RegenerateSecondaryKey(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TenantAccessClient.Update` + +```go +ctx := context.TODO() +id := tenantaccess.NewAccessID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "access") + +payload := tenantaccess.AccessInformationUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload, tenantaccess.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/client.go new file mode 100644 index 000000000000..d36cd27765c2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/client.go @@ -0,0 +1,26 @@ +package tenantaccess + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TenantAccessClient struct { + Client *resourcemanager.Client +} + +func NewTenantAccessClientWithBaseURI(sdkApi sdkEnv.Api) (*TenantAccessClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "tenantaccess", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TenantAccessClient: %+v", err) + } + + return &TenantAccessClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/constants.go new file mode 100644 index 000000000000..0a9a890aae2a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/constants.go @@ -0,0 +1,51 @@ +package tenantaccess + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessIdName string + +const ( + AccessIdNameAccess AccessIdName = "access" + AccessIdNameGitAccess AccessIdName = "gitAccess" +) + +func PossibleValuesForAccessIdName() []string { + return []string{ + string(AccessIdNameAccess), + string(AccessIdNameGitAccess), + } +} + +func (s *AccessIdName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAccessIdName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAccessIdName(input string) (*AccessIdName, error) { + vals := map[string]AccessIdName{ + "access": AccessIdNameAccess, + "gitaccess": AccessIdNameGitAccess, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessIdName(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/id_access.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/id_access.go new file mode 100644 index 000000000000..f65bd39036bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/id_access.go @@ -0,0 +1,156 @@ +package tenantaccess + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = AccessId{} + +// AccessId is a struct representing the Resource ID for a Access +type AccessId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + AccessName AccessIdName +} + +// NewAccessID returns a new AccessId struct +func NewAccessID(subscriptionId string, resourceGroupName string, serviceName string, accessName AccessIdName) AccessId { + return AccessId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + AccessName: accessName, + } +} + +// ParseAccessID parses 'input' into a AccessId +func ParseAccessID(input string) (*AccessId, error) { + parser := resourceids.NewParserFromResourceIdType(AccessId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccessId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if v, ok := parsed.Parsed["accessName"]; true { + if !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessName", *parsed) + } + + accessName, err := parseAccessIdName(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.AccessName = *accessName + } + + return &id, nil +} + +// ParseAccessIDInsensitively parses 'input' case-insensitively into a AccessId +// note: this method should only be used for API response data and not user input +func ParseAccessIDInsensitively(input string) (*AccessId, error) { + parser := resourceids.NewParserFromResourceIdType(AccessId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccessId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if v, ok := parsed.Parsed["accessName"]; true { + if !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessName", *parsed) + } + + accessName, err := parseAccessIdName(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.AccessName = *accessName + } + + return &id, nil +} + +// ValidateAccessID checks that 'input' can be parsed as a Access ID +func ValidateAccessID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAccessID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Access ID +func (id AccessId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/tenant/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, string(id.AccessName)) +} + +// Segments returns a slice of Resource ID Segments which comprise this Access ID +func (id AccessId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticTenant", "tenant", "tenant"), + resourceids.ConstantSegment("accessName", PossibleValuesForAccessIdName(), "access"), + } +} + +// String returns a human-readable description of this Access ID +func (id AccessId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Access Name: %q", string(id.AccessName)), + } + return fmt.Sprintf("Access (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/id_service.go new file mode 100644 index 000000000000..3a5122d04c9e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/id_service.go @@ -0,0 +1,127 @@ +package tenantaccess + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_create.go new file mode 100644 index 000000000000..cf2902da3893 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_create.go @@ -0,0 +1,84 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessInformationContract +} + +type CreateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOperationOptions() CreateOperationOptions { + return CreateOperationOptions{} +} + +func (o CreateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Create ... +func (c TenantAccessClient) Create(ctx context.Context, id AccessId, input AccessInformationCreateParameters, options CreateOperationOptions) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_get.go new file mode 100644 index 000000000000..b1f7d18cc3be --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_get.go @@ -0,0 +1,51 @@ +package tenantaccess + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessInformationContract +} + +// Get ... +func (c TenantAccessClient) Get(ctx context.Context, id AccessId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_getentitytag.go new file mode 100644 index 000000000000..d1d42ee00fd1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_getentitytag.go @@ -0,0 +1,46 @@ +package tenantaccess + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c TenantAccessClient) GetEntityTag(ctx context.Context, id AccessId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listbyservice.go new file mode 100644 index 000000000000..d332a10b9d55 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listbyservice.go @@ -0,0 +1,117 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AccessInformationContract +} + +type ListByServiceCompleteResult struct { + Items []AccessInformationContract +} + +type ListByServiceOperationOptions struct { + Filter *string +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + return &out +} + +// ListByService ... +func (c TenantAccessClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tenant", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AccessInformationContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c TenantAccessClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, AccessInformationContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TenantAccessClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate AccessInformationContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]AccessInformationContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listsecrets.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listsecrets.go new file mode 100644 index 000000000000..67b0b5f3a0bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listsecrets.go @@ -0,0 +1,52 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessInformationSecretsContract +} + +// ListSecrets ... +func (c TenantAccessClient) ListSecrets(ctx context.Context, id AccessId) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regenerateprimarykey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regenerateprimarykey.go new file mode 100644 index 000000000000..6d6aa0f1ccfb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regenerateprimarykey.go @@ -0,0 +1,47 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegeneratePrimaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegeneratePrimaryKey ... +func (c TenantAccessClient) RegeneratePrimaryKey(ctx context.Context, id AccessId) (result RegeneratePrimaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regeneratePrimaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regeneratesecondarykey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regeneratesecondarykey.go new file mode 100644 index 000000000000..0fd0b8fd2963 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regeneratesecondarykey.go @@ -0,0 +1,47 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateSecondaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegenerateSecondaryKey ... +func (c TenantAccessClient) RegenerateSecondaryKey(ctx context.Context, id AccessId) (result RegenerateSecondaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regenerateSecondaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_update.go new file mode 100644 index 000000000000..255888180b34 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/method_update.go @@ -0,0 +1,84 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessInformationContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c TenantAccessClient) Update(ctx context.Context, id AccessId, input AccessInformationUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcontract.go new file mode 100644 index 000000000000..3ad35991bed1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcontract.go @@ -0,0 +1,11 @@ +package tenantaccess + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessInformationContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AccessInformationContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcontractproperties.go new file mode 100644 index 000000000000..7a4c2313293a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcontractproperties.go @@ -0,0 +1,10 @@ +package tenantaccess + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessInformationContractProperties struct { + Enabled *bool `json:"enabled,omitempty"` + Id *string `json:"id,omitempty"` + PrincipalId *string `json:"principalId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcreateparameterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcreateparameterproperties.go new file mode 100644 index 000000000000..090055189908 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcreateparameterproperties.go @@ -0,0 +1,11 @@ +package tenantaccess + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessInformationCreateParameterProperties struct { + Enabled *bool `json:"enabled,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + PrincipalId *string `json:"principalId,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcreateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcreateparameters.go new file mode 100644 index 000000000000..0f13f9d72b9f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationcreateparameters.go @@ -0,0 +1,8 @@ +package tenantaccess + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessInformationCreateParameters struct { + Properties *AccessInformationCreateParameterProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationsecretscontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationsecretscontract.go new file mode 100644 index 000000000000..9ec1b2c9b420 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationsecretscontract.go @@ -0,0 +1,12 @@ +package tenantaccess + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessInformationSecretsContract struct { + Enabled *bool `json:"enabled,omitempty"` + Id *string `json:"id,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + PrincipalId *string `json:"principalId,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationupdateparameterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationupdateparameterproperties.go new file mode 100644 index 000000000000..30382f1f6372 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationupdateparameterproperties.go @@ -0,0 +1,8 @@ +package tenantaccess + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessInformationUpdateParameterProperties struct { + Enabled *bool `json:"enabled,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationupdateparameters.go new file mode 100644 index 000000000000..33de23ecca09 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/model_accessinformationupdateparameters.go @@ -0,0 +1,8 @@ +package tenantaccess + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessInformationUpdateParameters struct { + Properties *AccessInformationUpdateParameterProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/predicates.go new file mode 100644 index 000000000000..309dabec476e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/predicates.go @@ -0,0 +1,27 @@ +package tenantaccess + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessInformationContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p AccessInformationContractOperationPredicate) Matches(input AccessInformationContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/version.go new file mode 100644 index 000000000000..5a2af12fc297 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess/version.go @@ -0,0 +1,12 @@ +package tenantaccess + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/tenantaccess/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/README.md new file mode 100644 index 000000000000..d2b22f42e6a3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user` Documentation + +The `user` SDK allows for interaction with the Azure Resource Manager Service `apimanagement` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user" +``` + + +### Client Initialization + +```go +client := user.NewUserClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `UserClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := user.NewUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "userIdValue") + +payload := user.UserCreateParameters{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, user.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `UserClient.Delete` + +```go +ctx := context.TODO() +id := user.NewUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "userIdValue") + +read, err := client.Delete(ctx, id, user.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `UserClient.Get` + +```go +ctx := context.TODO() +id := user.NewUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "userIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `UserClient.GetEntityTag` + +```go +ctx := context.TODO() +id := user.NewUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "userIdValue") + +read, err := client.GetEntityTag(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `UserClient.ListByService` + +```go +ctx := context.TODO() +id := user.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue") + +// alternatively `client.ListByService(ctx, id, user.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, user.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `UserClient.Update` + +```go +ctx := context.TODO() +id := user.NewUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "userIdValue") + +payload := user.UserUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload, user.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/client.go new file mode 100644 index 000000000000..3d1a0eb8bf35 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/client.go @@ -0,0 +1,26 @@ +package user + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserClient struct { + Client *resourcemanager.Client +} + +func NewUserClientWithBaseURI(sdkApi sdkEnv.Api) (*UserClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "user", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UserClient: %+v", err) + } + + return &UserClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/constants.go new file mode 100644 index 000000000000..83573cf87af0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/constants.go @@ -0,0 +1,183 @@ +package user + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AppType string + +const ( + AppTypeDeveloperPortal AppType = "developerPortal" + AppTypePortal AppType = "portal" +) + +func PossibleValuesForAppType() []string { + return []string{ + string(AppTypeDeveloperPortal), + string(AppTypePortal), + } +} + +func (s *AppType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAppType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAppType(input string) (*AppType, error) { + vals := map[string]AppType{ + "developerportal": AppTypeDeveloperPortal, + "portal": AppTypePortal, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AppType(input) + return &out, nil +} + +type Confirmation string + +const ( + ConfirmationInvite Confirmation = "invite" + ConfirmationSignup Confirmation = "signup" +) + +func PossibleValuesForConfirmation() []string { + return []string{ + string(ConfirmationInvite), + string(ConfirmationSignup), + } +} + +func (s *Confirmation) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConfirmation(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseConfirmation(input string) (*Confirmation, error) { + vals := map[string]Confirmation{ + "invite": ConfirmationInvite, + "signup": ConfirmationSignup, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Confirmation(input) + return &out, nil +} + +type GroupType string + +const ( + GroupTypeCustom GroupType = "custom" + GroupTypeExternal GroupType = "external" + GroupTypeSystem GroupType = "system" +) + +func PossibleValuesForGroupType() []string { + return []string{ + string(GroupTypeCustom), + string(GroupTypeExternal), + string(GroupTypeSystem), + } +} + +func (s *GroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseGroupType(input string) (*GroupType, error) { + vals := map[string]GroupType{ + "custom": GroupTypeCustom, + "external": GroupTypeExternal, + "system": GroupTypeSystem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GroupType(input) + return &out, nil +} + +type UserState string + +const ( + UserStateActive UserState = "active" + UserStateBlocked UserState = "blocked" + UserStateDeleted UserState = "deleted" + UserStatePending UserState = "pending" +) + +func PossibleValuesForUserState() []string { + return []string{ + string(UserStateActive), + string(UserStateBlocked), + string(UserStateDeleted), + string(UserStatePending), + } +} + +func (s *UserState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUserState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseUserState(input string) (*UserState, error) { + vals := map[string]UserState{ + "active": UserStateActive, + "blocked": UserStateBlocked, + "deleted": UserStateDeleted, + "pending": UserStatePending, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UserState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/id_service.go new file mode 100644 index 000000000000..1747126f5199 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/id_service.go @@ -0,0 +1,127 @@ +package user + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/id_user.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/id_user.go new file mode 100644 index 000000000000..0b7943b4faeb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/id_user.go @@ -0,0 +1,140 @@ +package user + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = UserId{} + +// UserId is a struct representing the Resource ID for a User +type UserId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + UserId string +} + +// NewUserID returns a new UserId struct +func NewUserID(subscriptionId string, resourceGroupName string, serviceName string, userId string) UserId { + return UserId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + UserId: userId, + } +} + +// ParseUserID parses 'input' into a UserId +func ParseUserID(input string) (*UserId, error) { + parser := resourceids.NewParserFromResourceIdType(UserId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := UserId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.UserId, ok = parsed.Parsed["userId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + } + + return &id, nil +} + +// ParseUserIDInsensitively parses 'input' case-insensitively into a UserId +// note: this method should only be used for API response data and not user input +func ParseUserIDInsensitively(input string) (*UserId, error) { + parser := resourceids.NewParserFromResourceIdType(UserId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := UserId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + } + + if id.UserId, ok = parsed.Parsed["userId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + } + + return &id, nil +} + +// ValidateUserID checks that 'input' can be parsed as a User ID +func ValidateUserID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseUserID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted User ID +func (id UserId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ApiManagement/service/%s/users/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.UserId) +} + +// Segments returns a slice of Resource ID Segments which comprise this User ID +func (id UserId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApiManagement", "Microsoft.ApiManagement", "Microsoft.ApiManagement"), + resourceids.StaticSegment("staticService", "service", "service"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticUsers", "users", "users"), + resourceids.UserSpecifiedSegment("userId", "userIdValue"), + } +} + +// String returns a human-readable description of this User ID +func (id UserId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("User: %q", id.UserId), + } + return fmt.Sprintf("User (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_createorupdate.go new file mode 100644 index 000000000000..6ff0ddbf2512 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_createorupdate.go @@ -0,0 +1,88 @@ +package user + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *UserContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + Notify *bool +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Notify != nil { + out.Append("notify", fmt.Sprintf("%v", *o.Notify)) + } + return &out +} + +// CreateOrUpdate ... +func (c UserClient) CreateOrUpdate(ctx context.Context, id UserId, input UserCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_delete.go new file mode 100644 index 000000000000..fd6b3518902b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_delete.go @@ -0,0 +1,87 @@ +package user + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + AppType *AppType + DeleteSubscriptions *bool + IfMatch *string + Notify *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.AppType != nil { + out.Append("appType", fmt.Sprintf("%v", *o.AppType)) + } + if o.DeleteSubscriptions != nil { + out.Append("deleteSubscriptions", fmt.Sprintf("%v", *o.DeleteSubscriptions)) + } + if o.Notify != nil { + out.Append("notify", fmt.Sprintf("%v", *o.Notify)) + } + return &out +} + +// Delete ... +func (c UserClient) Delete(ctx context.Context, id UserId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_get.go new file mode 100644 index 000000000000..c70fed38ef82 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_get.go @@ -0,0 +1,51 @@ +package user + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *UserContract +} + +// Get ... +func (c UserClient) Get(ctx context.Context, id UserId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_getentitytag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_getentitytag.go new file mode 100644 index 000000000000..bc31a7c36972 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_getentitytag.go @@ -0,0 +1,46 @@ +package user + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c UserClient) GetEntityTag(ctx context.Context, id UserId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_listbyservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_listbyservice.go new file mode 100644 index 000000000000..5882829e90ca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_listbyservice.go @@ -0,0 +1,129 @@ +package user + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]UserContract +} + +type ListByServiceCompleteResult struct { + Items []UserContract +} + +type ListByServiceOperationOptions struct { + ExpandGroups *bool + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ExpandGroups != nil { + out.Append("expandGroups", fmt.Sprintf("%v", *o.ExpandGroups)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c UserClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/users", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]UserContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c UserClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, UserContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c UserClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate UserContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]UserContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_update.go new file mode 100644 index 000000000000..ed43e43248d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/method_update.go @@ -0,0 +1,84 @@ +package user + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *UserContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c UserClient) Update(ctx context.Context, id UserId, input UserUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_groupcontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_groupcontractproperties.go new file mode 100644 index 000000000000..1c489664e482 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_groupcontractproperties.go @@ -0,0 +1,12 @@ +package user + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupContractProperties struct { + BuiltIn *bool `json:"builtIn,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName string `json:"displayName"` + ExternalId *string `json:"externalId,omitempty"` + Type *GroupType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercontract.go new file mode 100644 index 000000000000..024c5b40beb0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercontract.go @@ -0,0 +1,11 @@ +package user + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserContract struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *UserContractProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercontractproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercontractproperties.go new file mode 100644 index 000000000000..b70e93a62f35 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercontractproperties.go @@ -0,0 +1,33 @@ +package user + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserContractProperties struct { + Email *string `json:"email,omitempty"` + FirstName *string `json:"firstName,omitempty"` + Groups *[]GroupContractProperties `json:"groups,omitempty"` + Identities *[]UserIdentityContract `json:"identities,omitempty"` + LastName *string `json:"lastName,omitempty"` + Note *string `json:"note,omitempty"` + RegistrationDate *string `json:"registrationDate,omitempty"` + State *UserState `json:"state,omitempty"` +} + +func (o *UserContractProperties) GetRegistrationDateAsTime() (*time.Time, error) { + if o.RegistrationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.RegistrationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *UserContractProperties) SetRegistrationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.RegistrationDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercreateparameterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercreateparameterproperties.go new file mode 100644 index 000000000000..8a9747c07bee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercreateparameterproperties.go @@ -0,0 +1,16 @@ +package user + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserCreateParameterProperties struct { + AppType *AppType `json:"appType,omitempty"` + Confirmation *Confirmation `json:"confirmation,omitempty"` + Email string `json:"email"` + FirstName string `json:"firstName"` + Identities *[]UserIdentityContract `json:"identities,omitempty"` + LastName string `json:"lastName"` + Note *string `json:"note,omitempty"` + Password *string `json:"password,omitempty"` + State *UserState `json:"state,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercreateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercreateparameters.go new file mode 100644 index 000000000000..06d702b0df78 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_usercreateparameters.go @@ -0,0 +1,8 @@ +package user + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserCreateParameters struct { + Properties *UserCreateParameterProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_useridentitycontract.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_useridentitycontract.go new file mode 100644 index 000000000000..c4b4b956d024 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_useridentitycontract.go @@ -0,0 +1,9 @@ +package user + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserIdentityContract struct { + Id *string `json:"id,omitempty"` + Provider *string `json:"provider,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_userupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_userupdateparameters.go new file mode 100644 index 000000000000..7ba5b6cdc3ed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_userupdateparameters.go @@ -0,0 +1,8 @@ +package user + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserUpdateParameters struct { + Properties *UserUpdateParametersProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_userupdateparametersproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_userupdateparametersproperties.go new file mode 100644 index 000000000000..32cbae72c300 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/model_userupdateparametersproperties.go @@ -0,0 +1,14 @@ +package user + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserUpdateParametersProperties struct { + Email *string `json:"email,omitempty"` + FirstName *string `json:"firstName,omitempty"` + Identities *[]UserIdentityContract `json:"identities,omitempty"` + LastName *string `json:"lastName,omitempty"` + Note *string `json:"note,omitempty"` + Password *string `json:"password,omitempty"` + State *UserState `json:"state,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/predicates.go new file mode 100644 index 000000000000..70f897ed2a90 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/predicates.go @@ -0,0 +1,27 @@ +package user + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserContractOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p UserContractOperationPredicate) Matches(input UserContract) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/version.go new file mode 100644 index 000000000000..b5fd58a15997 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user/version.go @@ -0,0 +1,12 @@ +package user + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/user/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 0e396be2d576..8a695959ab48 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,6 +1,5 @@ # github.com/Azure/azure-sdk-for-go v66.0.0+incompatible ## explicit -github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn @@ -140,7 +139,52 @@ github.com/hashicorp/go-azure-sdk/resource-manager/alertsmanagement/2023-03-01/p github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01 github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/analysisservices github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apimanagementservice +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperation +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationpolicy +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apioperationtag +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apipolicy +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apirelease +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apischema +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitag +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apitagdescription +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionset +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiversionsets +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/authorizationserver +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/backend +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/cache +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/certificate +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/delegationsettings +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/deletedservice +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/diagnostic +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/emailtemplates +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gateway +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayapi +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/group +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/groupuser +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/identityprovider +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/logger +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/namedvalue +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientemail +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/notificationrecipientuser +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/openidconnectprovider +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/policy +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/product +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productapi +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productgroup +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/productpolicy +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/producttag github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/schema +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signinsettings +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/signupsettings +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/subscription +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tag +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/tenantaccess +github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/user github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/configurationstores github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/deletedconfigurationstores github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/operations From 7c829db710564d78603bdf56db6a0fe30ddbcd96 Mon Sep 17 00:00:00 2001 From: Elena Xin Date: Tue, 8 Aug 2023 11:59:36 +0800 Subject: [PATCH 2/7] update code --- .../apimanagement/api_management_resource_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/services/apimanagement/api_management_resource_test.go b/internal/services/apimanagement/api_management_resource_test.go index 97c549814028..6b44167f49a2 100644 --- a/internal/services/apimanagement/api_management_resource_test.go +++ b/internal/services/apimanagement/api_management_resource_test.go @@ -8,6 +8,7 @@ import ( "fmt" "regexp" "testing" + "time" "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api" @@ -633,8 +634,11 @@ func (ApiManagementResource) testCheckHasNoProductsOrApis(resourceName string) p return err } + timeout, cancel := context.WithTimeout(ctx, 10*time.Minute) + defer cancel() + apiServiceId := api.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName) - listResp, err := client.ApiManagement.ApiClient.ListByService(ctx, apiServiceId, api.ListByServiceOperationOptions{}) + listResp, err := client.ApiManagement.ApiClient.ListByService(timeout, apiServiceId, api.ListByServiceOperationOptions{}) if err != nil { return fmt.Errorf("listing APIs after creation of %s: %+v", *id, err) } @@ -646,7 +650,7 @@ func (ApiManagementResource) testCheckHasNoProductsOrApis(resourceName string) p } produceServiceId := product.NewServiceID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName) - proListResp, err := client.ApiManagement.ProductsClient.ListByService(ctx, produceServiceId, product.ListByServiceOperationOptions{}) + proListResp, err := client.ApiManagement.ProductsClient.ListByService(timeout, produceServiceId, product.ListByServiceOperationOptions{}) if err != nil { return fmt.Errorf("listing products after creation of %s: %+v", *id, err) } From c393bf867e730722386222c5248275ffc751aa06 Mon Sep 17 00:00:00 2001 From: Elena Xin Date: Wed, 9 Aug 2023 14:55:47 +0800 Subject: [PATCH 3/7] update code --- .../apimanagement/api_management_resource.go | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/internal/services/apimanagement/api_management_resource.go b/internal/services/apimanagement/api_management_resource.go index 1b746bd931f9..0f0a963145b9 100644 --- a/internal/services/apimanagement/api_management_resource.go +++ b/internal/services/apimanagement/api_management_resource.go @@ -740,28 +740,9 @@ func resourceApiManagementServiceCreateUpdate(d *pluginsdk.ResourceData, meta in } // We only handle the error here because no request body is returned https://github.com/Azure/azure-rest-api-specs/issues/23456 - if _, err := client.CreateOrUpdate(ctx, id, params); err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, params); err != nil { return fmt.Errorf("recovering %s: %+v", id, err) } - - // Wait for the ProvisioningState to become "Succeeded" before attempting to update - log.Printf("[DEBUG] Waiting for %s to become ready", id) - deadline, ok := ctx.Deadline() - if !ok { - return fmt.Errorf("internal-error: context had no deadline") - } - stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{"Deleted", "Activating", "Updating", "Unknown"}, - Target: []string{"Succeeded", "Ready"}, - Refresh: apiManagementRefreshFunc(ctx, client, id), - MinTimeout: 1 * time.Minute, - ContinuousTargetOccurence: 2, - Timeout: time.Until(deadline), - } - - if _, err = stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for %s to become ready: %+v", id, err) - } } } From e47939caf6e09fcb676464179abbcbc90494ab3d Mon Sep 17 00:00:00 2001 From: Elena Xin Date: Thu, 10 Aug 2023 14:51:33 +0800 Subject: [PATCH 4/7] update code --- .../apimanagement/api_management_resource.go | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/internal/services/apimanagement/api_management_resource.go b/internal/services/apimanagement/api_management_resource.go index 0f0a963145b9..2116ba2a47b7 100644 --- a/internal/services/apimanagement/api_management_resource.go +++ b/internal/services/apimanagement/api_management_resource.go @@ -7,10 +7,12 @@ import ( "context" "fmt" "log" + "net/http" "strconv" "strings" "time" + "github.com/Azure/go-autorest/autorest" "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" @@ -739,8 +741,18 @@ func resourceApiManagementServiceCreateUpdate(d *pluginsdk.ResourceData, meta in Sku: sku, } - // We only handle the error here because no request body is returned https://github.com/Azure/azure-rest-api-specs/issues/23456 - if err := client.CreateOrUpdateThenPoll(ctx, id, params); err != nil { + // retry to restore service since there is an API issue : https://github.com/Azure/azure-rest-api-specs/issues/25262 + err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { + if err := client.CreateOrUpdateThenPoll(ctx, id, params); err != nil { + if v, ok := err.(autorest.DetailedError); ok && v.StatusCode == http.StatusBadRequest { + return pluginsdk.RetryableError(err) + } + return pluginsdk.NonRetryableError(err) + + } + return nil + }) + if err != nil { return fmt.Errorf("recovering %s: %+v", id, err) } } @@ -1170,8 +1182,8 @@ func resourceApiManagementServiceDelete(d *pluginsdk.ResourceData, meta interfac if _, err := deletedServicesClient.GetByName(ctx, deletedServiceId); err != nil { return fmt.Errorf("retrieving the deleted %s to be able to purge it: %+v", *id, err) } - if resp, err := deletedServicesClient.Purge(ctx, deletedServiceId); err != nil { - if !response.WasNotFound(resp.HttpResponse) { + if err := deletedServicesClient.PurgeThenPoll(ctx, deletedServiceId); err != nil { + if v, ok := err.(autorest.DetailedError); ok && v.StatusCode != http.StatusNotFound { return fmt.Errorf("purging the deleted %s: %+v", *id, err) } } From 7eb5e26452a009f625f0530f39800706e7eb5f0e Mon Sep 17 00:00:00 2001 From: "Elena Xin (PACTERA TECHNOLOGIES INC)" Date: Fri, 11 Aug 2023 10:31:19 +0800 Subject: [PATCH 5/7] update code --- .../apimanagement/api_management_resource.go | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/internal/services/apimanagement/api_management_resource.go b/internal/services/apimanagement/api_management_resource.go index 2116ba2a47b7..3d86b0897554 100644 --- a/internal/services/apimanagement/api_management_resource.go +++ b/internal/services/apimanagement/api_management_resource.go @@ -7,12 +7,10 @@ import ( "context" "fmt" "log" - "net/http" "strconv" "strings" "time" - "github.com/Azure/go-autorest/autorest" "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" @@ -743,12 +741,15 @@ func resourceApiManagementServiceCreateUpdate(d *pluginsdk.ResourceData, meta in // retry to restore service since there is an API issue : https://github.com/Azure/azure-rest-api-specs/issues/25262 err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { - if err := client.CreateOrUpdateThenPoll(ctx, id, params); err != nil { - if v, ok := err.(autorest.DetailedError); ok && v.StatusCode == http.StatusBadRequest { + resp, err := client.CreateOrUpdate(ctx, id, params) + if err != nil { + if response.WasBadRequest(resp.HttpResponse) { return pluginsdk.RetryableError(err) } return pluginsdk.NonRetryableError(err) - + } + if err := resp.Poller.PollUntilDone(ctx); err != nil { + return pluginsdk.NonRetryableError(err) } return nil }) @@ -1182,11 +1183,17 @@ func resourceApiManagementServiceDelete(d *pluginsdk.ResourceData, meta interfac if _, err := deletedServicesClient.GetByName(ctx, deletedServiceId); err != nil { return fmt.Errorf("retrieving the deleted %s to be able to purge it: %+v", *id, err) } - if err := deletedServicesClient.PurgeThenPoll(ctx, deletedServiceId); err != nil { - if v, ok := err.(autorest.DetailedError); ok && v.StatusCode != http.StatusNotFound { + resp, err := deletedServicesClient.Purge(ctx, deletedServiceId) + if err != nil && !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("purging the deleted %s: %+v", *id, err) + } + + if !response.WasNotFound(resp.HttpResponse) { + if err := resp.Poller.PollUntilDone(ctx); err != nil { return fmt.Errorf("purging the deleted %s: %+v", *id, err) } } + log.Printf("[DEBUG] Purged %s.", *id) return nil } From b8364ff86c4db20ca6b2dcfa7875fd7a00101a03 Mon Sep 17 00:00:00 2001 From: "Elena Xin (PACTERA TECHNOLOGIES INC)" Date: Tue, 15 Aug 2023 11:28:47 +0800 Subject: [PATCH 6/7] update code --- .../api_management_api_data_source.go | 38 +++++---- .../api_management_api_diagnostic_resource.go | 24 +++--- ...anagement_api_operation_policy_resource.go | 10 ++- .../api_management_api_operation_resource.go | 55 ++++++------ ...i_management_api_operation_tag_resource.go | 4 +- .../api_management_api_policy_resource.go | 19 +++-- .../api_management_api_release.go | 10 ++- .../api_management_api_resource.go | 83 ++++++++++--------- .../api_management_api_schema_resource.go | 36 ++++---- ...management_api_tag_description_resource.go | 10 ++- ..._management_api_version_set_data_source.go | 14 ++-- ...api_management_api_version_set_resource.go | 14 ++-- ...anagement_authorization_server_resource.go | 28 +++---- .../api_management_backend_resource.go | 20 ++--- .../api_management_certificate_resource.go | 10 +-- .../api_management_diagnostic_resource.go | 24 +++--- .../api_management_email_template_resource.go | 12 +-- ..._gateway_certificate_authority_resource.go | 4 +- .../api_management_gateway_data_source.go | 6 +- ...way_host_name_configuration_data_source.go | 15 ++-- .../api_management_gateway_resource.go | 9 +- .../api_management_group_data_source.go | 12 +-- ...nagement_identity_provider_aad_resource.go | 10 ++- ...ement_identity_provider_aadb2c_resource.go | 30 +++---- ...ent_identity_provider_facebook_resource.go | 6 +- ...ement_identity_provider_google_resource.go | 6 +- ...nt_identity_provider_microsoft_resource.go | 6 +- ...ment_identity_provider_twitter_resource.go | 6 +- .../api_management_logger_resource.go | 10 +-- .../api_management_named_value_resource.go | 22 ++--- .../api_management_policy_resource.go | 10 ++- .../api_management_product_data_source.go | 18 ++-- .../api_management_product_policy_resource.go | 10 ++- .../api_management_product_resource.go | 18 ++-- .../api_management_redis_cache_resource.go | 20 +++-- .../apimanagement/api_management_resource.go | 4 +- .../api_management_subscription_resource.go | 42 +++++----- .../api_management_tag_resource.go | 4 +- .../api_management_user_data_source.go | 14 ++-- .../api_management_user_resource.go | 14 ++-- .../apimanagement/migration/policy.go | 10 ++- 41 files changed, 387 insertions(+), 330 deletions(-) diff --git a/internal/services/apimanagement/api_management_api_data_source.go b/internal/services/apimanagement/api_management_api_data_source.go index fd26a8dbfc8f..17a575dc5b39 100644 --- a/internal/services/apimanagement/api_management_api_data_source.go +++ b/internal/services/apimanagement/api_management_api_data_source.go @@ -147,24 +147,26 @@ func dataSourceApiManagementApiRead(d *pluginsdk.ResourceData, meta interface{}) d.Set("name", name) d.Set("resource_group_name", id.ResourceGroupName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("description", pointer.From(model.Properties.Description)) - d.Set("display_name", pointer.From(model.Properties.DisplayName)) - d.Set("is_current", pointer.From(model.Properties.IsCurrent)) - d.Set("is_online", pointer.From(model.Properties.IsOnline)) - d.Set("path", model.Properties.Path) - d.Set("revision", pointer.From(model.Properties.ApiRevision)) - d.Set("service_url", pointer.From(model.Properties.ServiceUrl)) - d.Set("soap_pass_through", pointer.From(model.Properties.Type) == api.ApiTypeSoap) - d.Set("subscription_required", pointer.From(model.Properties.SubscriptionRequired)) - d.Set("version", pointer.From(model.Properties.ApiVersion)) - d.Set("version_set_id", pointer.From(model.Properties.ApiVersionSetId)) - if err := d.Set("protocols", flattenApiManagementApiDataSourceProtocols(model.Properties.Protocols)); err != nil { - return fmt.Errorf("setting `protocols`: %s", err) - } - - if err := d.Set("subscription_key_parameter_names", flattenApiManagementApiDataSourceSubscriptionKeyParamNames(model.Properties.SubscriptionKeyParameterNames)); err != nil { - return fmt.Errorf("setting `subscription_key_parameter_names`: %+v", err) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("description", pointer.From(props.Description)) + d.Set("display_name", pointer.From(props.DisplayName)) + d.Set("is_current", pointer.From(props.IsCurrent)) + d.Set("is_online", pointer.From(props.IsOnline)) + d.Set("path", props.Path) + d.Set("revision", pointer.From(props.ApiRevision)) + d.Set("service_url", pointer.From(props.ServiceUrl)) + d.Set("soap_pass_through", pointer.From(props.Type) == api.ApiTypeSoap) + d.Set("subscription_required", pointer.From(props.SubscriptionRequired)) + d.Set("version", pointer.From(props.ApiVersion)) + d.Set("version_set_id", pointer.From(props.ApiVersionSetId)) + if err := d.Set("protocols", flattenApiManagementApiDataSourceProtocols(props.Protocols)); err != nil { + return fmt.Errorf("setting `protocols`: %s", err) + } + + if err := d.Set("subscription_key_parameter_names", flattenApiManagementApiDataSourceSubscriptionKeyParamNames(props.SubscriptionKeyParameterNames)); err != nil { + return fmt.Errorf("setting `subscription_key_parameter_names`: %+v", err) + } } } return nil diff --git a/internal/services/apimanagement/api_management_api_diagnostic_resource.go b/internal/services/apimanagement/api_management_api_diagnostic_resource.go index eba3eea11326..00b5ca3769d5 100644 --- a/internal/services/apimanagement/api_management_api_diagnostic_resource.go +++ b/internal/services/apimanagement/api_management_api_diagnostic_resource.go @@ -287,23 +287,23 @@ func resourceApiManagementApiDiagnosticRead(d *pluginsdk.ResourceData, meta inte d.Set("api_management_name", diagnosticId.ServiceName) if model := resp.Model; model != nil { d.Set("identifier", pointer.From(model.Name)) - if model.Properties != nil { - d.Set("api_management_logger_id", model.Properties.LoggerId) - if model.Properties.Sampling != nil && model.Properties.Sampling.Percentage != nil { - d.Set("sampling_percentage", pointer.From(model.Properties.Sampling.Percentage)) + if props := model.Properties; props != nil { + d.Set("api_management_logger_id", props.LoggerId) + if props.Sampling != nil && props.Sampling.Percentage != nil { + d.Set("sampling_percentage", pointer.From(props.Sampling.Percentage)) } - d.Set("always_log_errors", pointer.From(model.Properties.AlwaysLog) == apidiagnostic.AlwaysLogAllErrors) - d.Set("verbosity", pointer.From(model.Properties.Verbosity)) - d.Set("log_client_ip", pointer.From(model.Properties.LogClientIP)) - d.Set("http_correlation_protocol", pointer.From(model.Properties.HTTPCorrelationProtocol)) - if frontend := model.Properties.Frontend; frontend != nil { + d.Set("always_log_errors", pointer.From(props.AlwaysLog) == apidiagnostic.AlwaysLogAllErrors) + d.Set("verbosity", pointer.From(props.Verbosity)) + d.Set("log_client_ip", pointer.From(props.LogClientIP)) + d.Set("http_correlation_protocol", pointer.From(props.HTTPCorrelationProtocol)) + if frontend := props.Frontend; frontend != nil { d.Set("frontend_request", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(frontend.Request)) d.Set("frontend_response", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(frontend.Response)) } else { d.Set("frontend_request", nil) d.Set("frontend_response", nil) } - if backend := model.Properties.Backend; backend != nil { + if backend := props.Backend; backend != nil { d.Set("backend_request", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(backend.Request)) d.Set("backend_response", flattenApiManagementApiDiagnosticHTTPMessageDiagnostic(backend.Response)) } else { @@ -312,8 +312,8 @@ func resourceApiManagementApiDiagnosticRead(d *pluginsdk.ResourceData, meta inte } format := string(apidiagnostic.OperationNameFormatName) - if model.Properties.OperationNameFormat != nil { - format = string(pointer.From(model.Properties.OperationNameFormat)) + if props.OperationNameFormat != nil { + format = string(pointer.From(props.OperationNameFormat)) } d.Set("operation_name_format", format) } diff --git a/internal/services/apimanagement/api_management_api_operation_policy_resource.go b/internal/services/apimanagement/api_management_api_operation_policy_resource.go index 0743e2225984..b8ee32d49614 100644 --- a/internal/services/apimanagement/api_management_api_operation_policy_resource.go +++ b/internal/services/apimanagement/api_management_api_operation_policy_resource.go @@ -153,10 +153,12 @@ func resourceApiManagementAPIOperationPolicyRead(d *pluginsdk.ResourceData, meta d.Set("api_name", apiName) d.Set("operation_id", operationName) - if model := resp.Model; model != nil && model.Properties != nil { - // when you submit an `xml_link` to the API, the API downloads this link and stores it as `xml_content` - // as such there is no way to set `xml_link` and we'll let Terraform handle it - d.Set("xml_content", html.UnescapeString(model.Properties.Value)) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + // when you submit an `xml_link` to the API, the API downloads this link and stores it as `xml_content` + // as such there is no way to set `xml_link` and we'll let Terraform handle it + d.Set("xml_content", html.UnescapeString(props.Value)) + } } return nil diff --git a/internal/services/apimanagement/api_management_api_operation_resource.go b/internal/services/apimanagement/api_management_api_operation_resource.go index a0b4d7ec6852..fd9290e5df1c 100644 --- a/internal/services/apimanagement/api_management_api_operation_resource.go +++ b/internal/services/apimanagement/api_management_api_operation_resource.go @@ -205,38 +205,39 @@ func resourceApiManagementApiOperationRead(d *pluginsdk.ResourceData, meta inter d.Set("api_management_name", id.ServiceName) d.Set("resource_group_name", id.ResourceGroupName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("description", pointer.From(model.Properties.Description)) - d.Set("display_name", model.Properties.DisplayName) - d.Set("method", model.Properties.Method) - d.Set("url_template", model.Properties.UrlTemplate) - - flattenedRequest, err := flattenApiManagementOperationRequestContract(model.Properties.Request) - if err != nil { - return err - } - if err := d.Set("request", flattenedRequest); err != nil { - return fmt.Errorf("flattening `request`: %+v", err) - } + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("description", pointer.From(props.Description)) + d.Set("display_name", props.DisplayName) + d.Set("method", props.Method) + d.Set("url_template", props.UrlTemplate) + + flattenedRequest, err := flattenApiManagementOperationRequestContract(props.Request) + if err != nil { + return err + } + if err := d.Set("request", flattenedRequest); err != nil { + return fmt.Errorf("flattening `request`: %+v", err) + } - flattenedResponse, err := flattenApiManagementOperationResponseContract(model.Properties.Responses) - if err != nil { - return err - } - if err := d.Set("response", flattenedResponse); err != nil { - return fmt.Errorf("flattening `response`: %+v", err) - } + flattenedResponse, err := flattenApiManagementOperationResponseContract(props.Responses) + if err != nil { + return err + } + if err := d.Set("response", flattenedResponse); err != nil { + return fmt.Errorf("flattening `response`: %+v", err) + } - flattenedTemplateParams, err := schemaz.FlattenApiManagementOperationParameterContract(model.Properties.TemplateParameters) - if err != nil { - return err - } + flattenedTemplateParams, err := schemaz.FlattenApiManagementOperationParameterContract(props.TemplateParameters) + if err != nil { + return err + } - if err := d.Set("template_parameter", flattenedTemplateParams); err != nil { - return fmt.Errorf("flattening `template_parameter`: %+v", err) + if err := d.Set("template_parameter", flattenedTemplateParams); err != nil { + return fmt.Errorf("flattening `template_parameter`: %+v", err) + } } } - return nil } diff --git a/internal/services/apimanagement/api_management_api_operation_tag_resource.go b/internal/services/apimanagement/api_management_api_operation_tag_resource.go index 2026773c10cf..fc6d36af818d 100644 --- a/internal/services/apimanagement/api_management_api_operation_tag_resource.go +++ b/internal/services/apimanagement/api_management_api_operation_tag_resource.go @@ -140,7 +140,9 @@ func resourceApiManagementApiOperationTagRead(d *pluginsdk.ResourceData, meta in d.Set("name", id.TagId) if model := resp.Model; model != nil { - d.Set("display_name", model.Properties.DisplayName) + if props := model.Properties; props != nil { + d.Set("display_name", props.DisplayName) + } } return nil diff --git a/internal/services/apimanagement/api_management_api_policy_resource.go b/internal/services/apimanagement/api_management_api_policy_resource.go index 222fb2f3e148..a47542f96b0c 100644 --- a/internal/services/apimanagement/api_management_api_policy_resource.go +++ b/internal/services/apimanagement/api_management_api_policy_resource.go @@ -152,17 +152,18 @@ func resourceApiManagementAPIPolicyRead(d *pluginsdk.ResourceData, meta interfac apiName := getApiName(id.ApiId) d.Set("api_name", apiName) - if model := resp.Model; model != nil && model.Properties != nil { - policyContent := "" - if pc := model.Properties.Value; pc != "" { - policyContent = html.UnescapeString(pc) - } + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + policyContent := "" + if pc := props.Value; pc != "" { + policyContent = html.UnescapeString(pc) + } - // when you submit an `xml_link` to the API, the API downloads this link and stores it as `xml_content` - // as such there is no way to set `xml_link` and we'll let Terraform handle it - d.Set("xml_content", policyContent) + // when you submit an `xml_link` to the API, the API downloads this link and stores it as `xml_content` + // as such there is no way to set `xml_link` and we'll let Terraform handle it + d.Set("xml_content", policyContent) + } } - return nil } diff --git a/internal/services/apimanagement/api_management_api_release.go b/internal/services/apimanagement/api_management_api_release.go index e1ea7492e517..2a4a67f79bc9 100644 --- a/internal/services/apimanagement/api_management_api_release.go +++ b/internal/services/apimanagement/api_management_api_release.go @@ -129,10 +129,12 @@ func resourceApiManagementApiReleaseRead(d *pluginsdk.ResourceData, meta interfa return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("name", id.ReleaseId) - if model := resp.Model; model != nil && model.Properties != nil { - apiName := getApiName(id.ApiId) - d.Set("api_id", api.NewApiID(subscriptionId, id.ResourceGroupName, id.ServiceName, apiName).ID()) - d.Set("notes", pointer.From(model.Properties.Notes)) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + apiName := getApiName(id.ApiId) + d.Set("api_id", api.NewApiID(subscriptionId, id.ResourceGroupName, id.ServiceName, apiName).ID()) + d.Set("notes", pointer.From(props.Notes)) + } } return nil } diff --git a/internal/services/apimanagement/api_management_api_resource.go b/internal/services/apimanagement/api_management_api_resource.go index 5205a10ae71d..d89657647d8c 100644 --- a/internal/services/apimanagement/api_management_api_resource.go +++ b/internal/services/apimanagement/api_management_api_resource.go @@ -533,54 +533,55 @@ func resourceApiManagementApiRead(d *pluginsdk.ResourceData, meta interface{}) e d.Set("name", name) d.Set("resource_group_name", id.ResourceGroupName) - if model := resp.Model; model != nil && model.Properties != nil { - apiType := string(pointer.From(model.Properties.Type)) - if len(apiType) == 0 { - apiType = string(api.ApiTypeHTTP) - } - d.Set("api_type", apiType) - d.Set("description", pointer.From(model.Properties.Description)) - d.Set("display_name", pointer.From(model.Properties.DisplayName)) - d.Set("is_current", pointer.From(model.Properties.IsCurrent)) - d.Set("is_online", pointer.From(model.Properties.IsOnline)) - d.Set("path", model.Properties.Path) - d.Set("service_url", pointer.From(model.Properties.ServiceUrl)) - d.Set("revision", pointer.From(model.Properties.ApiRevision)) - if !features.FourPointOhBeta() { - d.Set("soap_pass_through", apiType == string(api.ApiTypeSoap)) - } - d.Set("subscription_required", pointer.From(model.Properties.SubscriptionRequired)) - d.Set("version", pointer.From(model.Properties.ApiVersion)) - d.Set("version_set_id", pointer.From(model.Properties.ApiVersionSetId)) - d.Set("revision_description", pointer.From(model.Properties.ApiRevisionDescription)) - d.Set("version_description", pointer.From(model.Properties.ApiVersionDescription)) - d.Set("terms_of_service_url", pointer.From(model.Properties.TermsOfServiceUrl)) - - if err := d.Set("protocols", flattenApiManagementApiProtocols(model.Properties.Protocols)); err != nil { - return fmt.Errorf("setting `protocols`: %s", err) - } + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + apiType := string(pointer.From(props.Type)) + if len(apiType) == 0 { + apiType = string(api.ApiTypeHTTP) + } + d.Set("api_type", apiType) + d.Set("description", pointer.From(props.Description)) + d.Set("display_name", pointer.From(props.DisplayName)) + d.Set("is_current", pointer.From(props.IsCurrent)) + d.Set("is_online", pointer.From(props.IsOnline)) + d.Set("path", props.Path) + d.Set("service_url", pointer.From(props.ServiceUrl)) + d.Set("revision", pointer.From(props.ApiRevision)) + if !features.FourPointOhBeta() { + d.Set("soap_pass_through", apiType == string(api.ApiTypeSoap)) + } + d.Set("subscription_required", pointer.From(props.SubscriptionRequired)) + d.Set("version", pointer.From(props.ApiVersion)) + d.Set("version_set_id", pointer.From(props.ApiVersionSetId)) + d.Set("revision_description", pointer.From(props.ApiRevisionDescription)) + d.Set("version_description", pointer.From(props.ApiVersionDescription)) + d.Set("terms_of_service_url", pointer.From(props.TermsOfServiceUrl)) + + if err := d.Set("protocols", flattenApiManagementApiProtocols(props.Protocols)); err != nil { + return fmt.Errorf("setting `protocols`: %s", err) + } - if err := d.Set("subscription_key_parameter_names", flattenApiManagementApiSubscriptionKeyParamNames(model.Properties.SubscriptionKeyParameterNames)); err != nil { - return fmt.Errorf("setting `subscription_key_parameter_names`: %+v", err) - } + if err := d.Set("subscription_key_parameter_names", flattenApiManagementApiSubscriptionKeyParamNames(props.SubscriptionKeyParameterNames)); err != nil { + return fmt.Errorf("setting `subscription_key_parameter_names`: %+v", err) + } - if err := d.Set("oauth2_authorization", flattenApiManagementOAuth2Authorization(model.Properties.AuthenticationSettings.OAuth2)); err != nil { - return fmt.Errorf("setting `oauth2_authorization`: %+v", err) - } + if err := d.Set("oauth2_authorization", flattenApiManagementOAuth2Authorization(props.AuthenticationSettings.OAuth2)); err != nil { + return fmt.Errorf("setting `oauth2_authorization`: %+v", err) + } - if err := d.Set("openid_authentication", flattenApiManagementOpenIDAuthentication(model.Properties.AuthenticationSettings.Openid)); err != nil { - return fmt.Errorf("setting `openid_authentication`: %+v", err) - } + if err := d.Set("openid_authentication", flattenApiManagementOpenIDAuthentication(props.AuthenticationSettings.Openid)); err != nil { + return fmt.Errorf("setting `openid_authentication`: %+v", err) + } - if err := d.Set("contact", flattenApiManagementApiContact(model.Properties.Contact)); err != nil { - return fmt.Errorf("setting `contact`: %+v", err) - } + if err := d.Set("contact", flattenApiManagementApiContact(props.Contact)); err != nil { + return fmt.Errorf("setting `contact`: %+v", err) + } - if err := d.Set("license", flattenApiManagementApiLicense(model.Properties.License)); err != nil { - return fmt.Errorf("setting `license`: %+v", err) + if err := d.Set("license", flattenApiManagementApiLicense(props.License)); err != nil { + return fmt.Errorf("setting `license`: %+v", err) + } } } - return nil } diff --git a/internal/services/apimanagement/api_management_api_schema_resource.go b/internal/services/apimanagement/api_management_api_schema_resource.go index 9d533964e120..07b6790d14d2 100644 --- a/internal/services/apimanagement/api_management_api_schema_resource.go +++ b/internal/services/apimanagement/api_management_api_schema_resource.go @@ -158,27 +158,29 @@ func resourceApiManagementApiSchemaRead(d *pluginsdk.ResourceData, meta interfac d.Set("api_name", id.ApiId) d.Set("schema_id", id.SchemaId) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("content_type", model.Properties.ContentType) - if documentProperties := model.Properties.Document; documentProperties != nil { - if documentProperties.Value != nil { - d.Set("value", pointer.From(documentProperties.Value)) - } + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("content_type", props.ContentType) + if documentProperties := props.Document; documentProperties != nil { + if documentProperties.Value != nil { + d.Set("value", pointer.From(documentProperties.Value)) + } - if documentProperties.Components != nil { - value, err := convert2Str(pointer.From(documentProperties.Components)) - if err != nil { - return err + if documentProperties.Components != nil { + value, err := convert2Str(pointer.From(documentProperties.Components)) + if err != nil { + return err + } + d.Set("components", value) } - d.Set("components", value) - } - if documentProperties.Definitions != nil { - value, err := convert2Str(documentProperties.Definitions) - if err != nil { - return err + if documentProperties.Definitions != nil { + value, err := convert2Str(documentProperties.Definitions) + if err != nil { + return err + } + d.Set("definitions", value) } - d.Set("definitions", value) } } } diff --git a/internal/services/apimanagement/api_management_api_tag_description_resource.go b/internal/services/apimanagement/api_management_api_tag_description_resource.go index 00b06da093ed..f431cf8296ad 100644 --- a/internal/services/apimanagement/api_management_api_tag_description_resource.go +++ b/internal/services/apimanagement/api_management_api_tag_description_resource.go @@ -142,10 +142,12 @@ func resourceApiManagementApiTagDescriptionRead(d *pluginsdk.ResourceData, meta apiTagId := apitag.NewApiTagID(id.SubscriptionId, id.ResourceGroupName, id.ServiceName, apiName, id.TagDescriptionId) d.Set("api_tag_id", apiTagId.ID()) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("description", pointer.From(model.Properties.Description)) - d.Set("external_documentation_url", pointer.From(model.Properties.ExternalDocsUrl)) - d.Set("external_documentation_description", pointer.From(model.Properties.ExternalDocsDescription)) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("description", pointer.From(props.Description)) + d.Set("external_documentation_url", pointer.From(props.ExternalDocsUrl)) + d.Set("external_documentation_description", pointer.From(props.ExternalDocsDescription)) + } } return nil diff --git a/internal/services/apimanagement/api_management_api_version_set_data_source.go b/internal/services/apimanagement/api_management_api_version_set_data_source.go index a4c71d4d7f75..7dddf7ec5994 100644 --- a/internal/services/apimanagement/api_management_api_version_set_data_source.go +++ b/internal/services/apimanagement/api_management_api_version_set_data_source.go @@ -91,12 +91,14 @@ func dataSourceApiManagementApiVersionSetRead(d *pluginsdk.ResourceData, meta in d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("description", pointer.From(model.Properties.Description)) - d.Set("display_name", model.Properties.DisplayName) - d.Set("versioning_scheme", string(model.Properties.VersioningScheme)) - d.Set("version_header_name", pointer.From(model.Properties.VersionHeaderName)) - d.Set("version_query_name", pointer.From(model.Properties.VersionQueryName)) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("description", pointer.From(props.Description)) + d.Set("display_name", props.DisplayName) + d.Set("versioning_scheme", string(props.VersioningScheme)) + d.Set("version_header_name", pointer.From(props.VersionHeaderName)) + d.Set("version_query_name", pointer.From(props.VersionQueryName)) + } } return nil diff --git a/internal/services/apimanagement/api_management_api_version_set_resource.go b/internal/services/apimanagement/api_management_api_version_set_resource.go index 1b4e0a128800..fe736ca4d865 100644 --- a/internal/services/apimanagement/api_management_api_version_set_resource.go +++ b/internal/services/apimanagement/api_management_api_version_set_resource.go @@ -191,12 +191,14 @@ func resourceApiManagementApiVersionSetRead(d *pluginsdk.ResourceData, meta inte d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("description", pointer.From(model.Properties.Description)) - d.Set("display_name", model.Properties.DisplayName) - d.Set("versioning_scheme", string(model.Properties.VersioningScheme)) - d.Set("version_header_name", pointer.From(model.Properties.VersionHeaderName)) - d.Set("version_query_name", pointer.From(model.Properties.VersionQueryName)) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("description", pointer.From(props.Description)) + d.Set("display_name", props.DisplayName) + d.Set("versioning_scheme", string(props.VersioningScheme)) + d.Set("version_header_name", pointer.From(props.VersionHeaderName)) + d.Set("version_query_name", pointer.From(props.VersionQueryName)) + } } return nil diff --git a/internal/services/apimanagement/api_management_authorization_server_resource.go b/internal/services/apimanagement/api_management_authorization_server_resource.go index a3ce41dbe60d..ef089214b64c 100644 --- a/internal/services/apimanagement/api_management_authorization_server_resource.go +++ b/internal/services/apimanagement/api_management_authorization_server_resource.go @@ -300,37 +300,37 @@ func resourceApiManagementAuthorizationServerRead(d *pluginsdk.ResourceData, met if model := resp.Model; model != nil { d.Set("name", pointer.From(model.Name)) - if model.Properties != nil { - d.Set("authorization_endpoint", model.Properties.AuthorizationEndpoint) - d.Set("client_id", model.Properties.ClientId) - d.Set("client_registration_endpoint", model.Properties.ClientRegistrationEndpoint) - d.Set("default_scope", pointer.From(model.Properties.DefaultScope)) - d.Set("description", pointer.From(model.Properties.Description)) - d.Set("display_name", model.Properties.DisplayName) - d.Set("support_state", pointer.From(model.Properties.SupportState)) - d.Set("token_endpoint", pointer.From(model.Properties.TokenEndpoint)) + if props := model.Properties; props != nil { + d.Set("authorization_endpoint", props.AuthorizationEndpoint) + d.Set("client_id", props.ClientId) + d.Set("client_registration_endpoint", props.ClientRegistrationEndpoint) + d.Set("default_scope", pointer.From(props.DefaultScope)) + d.Set("description", pointer.From(props.Description)) + d.Set("display_name", props.DisplayName) + d.Set("support_state", pointer.From(props.SupportState)) + d.Set("token_endpoint", pointer.From(props.TokenEndpoint)) // TODO: Read properties from api, https://github.com/Azure/azure-rest-api-specs/issues/14128 d.Set("resource_owner_password", d.Get("resource_owner_password").(string)) d.Set("resource_owner_username", d.Get("resource_owner_username").(string)) - if err := d.Set("authorization_methods", flattenApiManagementAuthorizationServerAuthorizationMethods(model.Properties.AuthorizationMethods)); err != nil { + if err := d.Set("authorization_methods", flattenApiManagementAuthorizationServerAuthorizationMethods(props.AuthorizationMethods)); err != nil { return fmt.Errorf("flattening `authorization_methods`: %+v", err) } - if err := d.Set("bearer_token_sending_methods", flattenApiManagementAuthorizationServerBearerTokenSendingMethods(model.Properties.BearerTokenSendingMethods)); err != nil { + if err := d.Set("bearer_token_sending_methods", flattenApiManagementAuthorizationServerBearerTokenSendingMethods(props.BearerTokenSendingMethods)); err != nil { return fmt.Errorf("flattening `bearer_token_sending_methods`: %+v", err) } - if err := d.Set("client_authentication_method", flattenApiManagementAuthorizationServerClientAuthenticationMethods(model.Properties.ClientAuthenticationMethod)); err != nil { + if err := d.Set("client_authentication_method", flattenApiManagementAuthorizationServerClientAuthenticationMethods(props.ClientAuthenticationMethod)); err != nil { return fmt.Errorf("flattening `client_authentication_method`: %+v", err) } - if err := d.Set("grant_types", flattenApiManagementAuthorizationServerGrantTypes(model.Properties.GrantTypes)); err != nil { + if err := d.Set("grant_types", flattenApiManagementAuthorizationServerGrantTypes(props.GrantTypes)); err != nil { return fmt.Errorf("flattening `grant_types`: %+v", err) } - if err := d.Set("token_body_parameter", flattenApiManagementAuthorizationServerTokenBodyParameters(model.Properties.TokenBodyParameters)); err != nil { + if err := d.Set("token_body_parameter", flattenApiManagementAuthorizationServerTokenBodyParameters(props.TokenBodyParameters)); err != nil { return fmt.Errorf("flattening `token_body_parameter`: %+v", err) } } diff --git a/internal/services/apimanagement/api_management_backend_resource.go b/internal/services/apimanagement/api_management_backend_resource.go index 406abd6ab953..a990324ed88b 100644 --- a/internal/services/apimanagement/api_management_backend_resource.go +++ b/internal/services/apimanagement/api_management_backend_resource.go @@ -349,24 +349,24 @@ func resourceApiManagementBackendRead(d *pluginsdk.ResourceData, meta interface{ if model := resp.Model; model != nil { d.Set("name", pointer.From(model.Name)) - if model.Properties != nil { - d.Set("description", pointer.From(model.Properties.Description)) - d.Set("protocol", string(model.Properties.Protocol)) - d.Set("resource_id", pointer.From(model.Properties.ResourceId)) - d.Set("title", pointer.From(model.Properties.Title)) - d.Set("url", model.Properties.Url) - if err := d.Set("credentials", flattenApiManagementBackendCredentials(model.Properties.Credentials)); err != nil { + if props := model.Properties; props != nil { + d.Set("description", pointer.From(props.Description)) + d.Set("protocol", string(props.Protocol)) + d.Set("resource_id", pointer.From(props.ResourceId)) + d.Set("title", pointer.From(props.Title)) + d.Set("url", props.Url) + if err := d.Set("credentials", flattenApiManagementBackendCredentials(props.Credentials)); err != nil { return fmt.Errorf("setting `credentials`: %s", err) } - if err := d.Set("proxy", flattenApiManagementBackendProxy(model.Properties.Proxy)); err != nil { + if err := d.Set("proxy", flattenApiManagementBackendProxy(props.Proxy)); err != nil { return fmt.Errorf("setting `proxy`: %s", err) } - if properties := model.Properties.Properties; properties != nil { + if properties := props.Properties; properties != nil { if err := d.Set("service_fabric_cluster", flattenApiManagementBackendServiceFabricCluster(properties.ServiceFabricCluster)); err != nil { return fmt.Errorf("setting `service_fabric_cluster`: %s", err) } } - if err := d.Set("tls", flattenApiManagementBackendTls(model.Properties.Tls)); err != nil { + if err := d.Set("tls", flattenApiManagementBackendTls(props.Tls)); err != nil { return fmt.Errorf("setting `tls`: %s", err) } } diff --git a/internal/services/apimanagement/api_management_certificate_resource.go b/internal/services/apimanagement/api_management_certificate_resource.go index e8973ea52aa1..f979aa47bf5d 100644 --- a/internal/services/apimanagement/api_management_certificate_resource.go +++ b/internal/services/apimanagement/api_management_certificate_resource.go @@ -181,12 +181,12 @@ func resourceApiManagementCertificateRead(d *pluginsdk.ResourceData, meta interf if model := resp.Model; model != nil { d.Set("name", pointer.From(model.Name)) - if model.Properties != nil { - d.Set("expiration", model.Properties.ExpirationDate) - d.Set("subject", model.Properties.Subject) - d.Set("thumbprint", model.Properties.Thumbprint) + if props := model.Properties; props != nil { + d.Set("expiration", props.ExpirationDate) + d.Set("subject", props.Subject) + d.Set("thumbprint", props.Thumbprint) - if keyvault := model.Properties.KeyVault; keyvault != nil { + if keyvault := props.KeyVault; keyvault != nil { d.Set("key_vault_secret_id", pointer.From(keyvault.SecretIdentifier)) d.Set("key_vault_identity_client_id", pointer.From(keyvault.IdentityClientId)) } diff --git a/internal/services/apimanagement/api_management_diagnostic_resource.go b/internal/services/apimanagement/api_management_diagnostic_resource.go index a7df4f522c9e..02aa56bbe4ef 100644 --- a/internal/services/apimanagement/api_management_diagnostic_resource.go +++ b/internal/services/apimanagement/api_management_diagnostic_resource.go @@ -236,23 +236,23 @@ func resourceApiManagementDiagnosticRead(d *pluginsdk.ResourceData, meta interfa d.Set("api_management_name", diagnosticId.ServiceName) if model := resp.Model; model != nil { d.Set("identifier", pointer.From(model.Name)) - if model.Properties != nil { - d.Set("api_management_logger_id", model.Properties.LoggerId) - if model.Properties.Sampling != nil && model.Properties.Sampling.Percentage != nil { - d.Set("sampling_percentage", pointer.From(model.Properties.Sampling.Percentage)) + if props := model.Properties; props != nil { + d.Set("api_management_logger_id", props.LoggerId) + if props.Sampling != nil && props.Sampling.Percentage != nil { + d.Set("sampling_percentage", pointer.From(props.Sampling.Percentage)) } - d.Set("always_log_errors", pointer.From(model.Properties.AlwaysLog) == diagnostic.AlwaysLogAllErrors) - d.Set("verbosity", pointer.From(model.Properties.Verbosity)) - d.Set("log_client_ip", pointer.From(model.Properties.LogClientIP)) - d.Set("http_correlation_protocol", pointer.From(model.Properties.HTTPCorrelationProtocol)) - if frontend := model.Properties.Frontend; frontend != nil { + d.Set("always_log_errors", pointer.From(props.AlwaysLog) == diagnostic.AlwaysLogAllErrors) + d.Set("verbosity", pointer.From(props.Verbosity)) + d.Set("log_client_ip", pointer.From(props.LogClientIP)) + d.Set("http_correlation_protocol", pointer.From(props.HTTPCorrelationProtocol)) + if frontend := props.Frontend; frontend != nil { d.Set("frontend_request", flattenApiManagementDiagnosticHTTPMessageDiagnostic(frontend.Request)) d.Set("frontend_response", flattenApiManagementDiagnosticHTTPMessageDiagnostic(frontend.Response)) } else { d.Set("frontend_request", nil) d.Set("frontend_response", nil) } - if backend := model.Properties.Backend; backend != nil { + if backend := props.Backend; backend != nil { d.Set("backend_request", flattenApiManagementDiagnosticHTTPMessageDiagnostic(backend.Request)) d.Set("backend_response", flattenApiManagementDiagnosticHTTPMessageDiagnostic(backend.Response)) } else { @@ -260,8 +260,8 @@ func resourceApiManagementDiagnosticRead(d *pluginsdk.ResourceData, meta interfa d.Set("backend_response", nil) } format := string(diagnostic.OperationNameFormatName) - if model.Properties.OperationNameFormat != nil { - format = string(pointer.From(model.Properties.OperationNameFormat)) + if props.OperationNameFormat != nil { + format = string(pointer.From(props.OperationNameFormat)) } d.Set("operation_name_format", format) } diff --git a/internal/services/apimanagement/api_management_email_template_resource.go b/internal/services/apimanagement/api_management_email_template_resource.go index 0b9943fbe75f..0f387977b245 100644 --- a/internal/services/apimanagement/api_management_email_template_resource.go +++ b/internal/services/apimanagement/api_management_email_template_resource.go @@ -156,11 +156,13 @@ func resourceApiManagementEmailTemplateRead(d *pluginsdk.ResourceData, meta inte d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) d.Set("template_name", templateName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("title", pointer.From(model.Properties.Title)) - d.Set("description", pointer.From(model.Properties.Description)) - d.Set("subject", model.Properties.Subject) - d.Set("body", model.Properties.Body) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("title", pointer.From(props.Title)) + d.Set("description", pointer.From(props.Description)) + d.Set("subject", props.Subject) + d.Set("body", props.Body) + } } return nil diff --git a/internal/services/apimanagement/api_management_gateway_certificate_authority_resource.go b/internal/services/apimanagement/api_management_gateway_certificate_authority_resource.go index 8f8ae104b6bf..52b829972f91 100644 --- a/internal/services/apimanagement/api_management_gateway_certificate_authority_resource.go +++ b/internal/services/apimanagement/api_management_gateway_certificate_authority_resource.go @@ -128,8 +128,8 @@ func resourceApiManagementGatewayCertificateAuthorityRead(d *pluginsdk.ResourceD if model := resp.Model; model != nil { d.Set("certificate_name", pointer.From(model.Name)) - if model.Properties != nil { - d.Set("is_trusted", pointer.From(model.Properties.IsTrusted)) + if props := model.Properties; props != nil { + d.Set("is_trusted", pointer.From(props.IsTrusted)) } } diff --git a/internal/services/apimanagement/api_management_gateway_data_source.go b/internal/services/apimanagement/api_management_gateway_data_source.go index 54b0a253aad2..7cb60fb65488 100644 --- a/internal/services/apimanagement/api_management_gateway_data_source.go +++ b/internal/services/apimanagement/api_management_gateway_data_source.go @@ -100,9 +100,9 @@ func dataSourceApiManagementGatewayRead(d *pluginsdk.ResourceData, meta interfac if model := resp.Model; model != nil { d.Set("name", pointer.From(model.Name)) - if model.Properties != nil { - d.Set("description", pointer.From(model.Properties.Description)) - d.Set("location_data", flattenApiManagementGatewayLocationData(model.Properties.LocationData)) + if props := model.Properties; props != nil { + d.Set("description", pointer.From(props.Description)) + d.Set("location_data", flattenApiManagementGatewayLocationData(props.LocationData)) } } diff --git a/internal/services/apimanagement/api_management_gateway_host_name_configuration_data_source.go b/internal/services/apimanagement/api_management_gateway_host_name_configuration_data_source.go index fdf2b40677d4..896ba8da908b 100644 --- a/internal/services/apimanagement/api_management_gateway_host_name_configuration_data_source.go +++ b/internal/services/apimanagement/api_management_gateway_host_name_configuration_data_source.go @@ -100,13 +100,14 @@ func dataSourceApiManagementGatewayHostnameConfigurationRead(d *pluginsdk.Resour if err != nil { return fmt.Errorf("parsing GatewayHostnameConfiguration ID %q", *model.Id) } - - d.Set("host_name", model.Properties.Hostname) - d.Set("certificate_id", model.Properties.CertificateId) - d.Set("request_client_certificate_enabled", model.Properties.NegotiateClientCertificate) - d.Set("tls10_enabled", model.Properties.Tls10Enabled) - d.Set("tls11_enabled", model.Properties.Tls11Enabled) - d.Set("http2_enabled", model.Properties.HTTP2Enabled) + if props := model.Properties; props != nil { + d.Set("host_name", props.Hostname) + d.Set("certificate_id", props.CertificateId) + d.Set("request_client_certificate_enabled", props.NegotiateClientCertificate) + d.Set("tls10_enabled", props.Tls10Enabled) + d.Set("tls11_enabled", props.Tls11Enabled) + d.Set("http2_enabled", props.HTTP2Enabled) + } } d.SetId(id.ID()) diff --git a/internal/services/apimanagement/api_management_gateway_resource.go b/internal/services/apimanagement/api_management_gateway_resource.go index ab0030fd5193..bbe642b18b63 100644 --- a/internal/services/apimanagement/api_management_gateway_resource.go +++ b/internal/services/apimanagement/api_management_gateway_resource.go @@ -151,10 +151,11 @@ func resourceApiManagementGatewayRead(d *pluginsdk.ResourceData, meta interface{ d.Set("name", id.GatewayId) d.Set("api_management_id", apimId.ID()) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("description", pointer.From(model.Properties.Description)) - d.Set("location_data", flattenApiManagementGatewayLocationData(model.Properties.LocationData)) - + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("description", pointer.From(props.Description)) + d.Set("location_data", flattenApiManagementGatewayLocationData(props.LocationData)) + } } return nil diff --git a/internal/services/apimanagement/api_management_group_data_source.go b/internal/services/apimanagement/api_management_group_data_source.go index 87a981a231db..5d3d3cdab513 100644 --- a/internal/services/apimanagement/api_management_group_data_source.go +++ b/internal/services/apimanagement/api_management_group_data_source.go @@ -80,11 +80,13 @@ func dataSourceApiManagementGroupRead(d *pluginsdk.ResourceData, meta interface{ d.Set("resource_group_name", resourceGroup) d.Set("api_management_name", serviceName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("display_name", model.Properties.DisplayName) - d.Set("description", pointer.From(model.Properties.Description)) - d.Set("external_id", pointer.From(model.Properties.ExternalId)) - d.Set("type", string(pointer.From(model.Properties.Type))) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("display_name", props.DisplayName) + d.Set("description", pointer.From(props.Description)) + d.Set("external_id", pointer.From(props.ExternalId)) + d.Set("type", string(pointer.From(props.Type))) + } } return nil diff --git a/internal/services/apimanagement/api_management_identity_provider_aad_resource.go b/internal/services/apimanagement/api_management_identity_provider_aad_resource.go index ca46dd56c94f..2c4f0a465caa 100644 --- a/internal/services/apimanagement/api_management_identity_provider_aad_resource.go +++ b/internal/services/apimanagement/api_management_identity_provider_aad_resource.go @@ -142,10 +142,12 @@ func resourceApiManagementIdentityProviderAADRead(d *pluginsdk.ResourceData, met d.Set("resource_group_name", resourceGroup) d.Set("api_management_name", serviceName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("client_id", model.Properties.ClientId) - d.Set("allowed_tenants", pointer.From(model.Properties.AllowedTenants)) - d.Set("signin_tenant", pointer.From(model.Properties.SigninTenant)) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("client_id", props.ClientId) + d.Set("allowed_tenants", pointer.From(props.AllowedTenants)) + d.Set("signin_tenant", pointer.From(props.SigninTenant)) + } } return nil diff --git a/internal/services/apimanagement/api_management_identity_provider_aadb2c_resource.go b/internal/services/apimanagement/api_management_identity_provider_aadb2c_resource.go index 4516ffd3d827..76618d321052 100644 --- a/internal/services/apimanagement/api_management_identity_provider_aadb2c_resource.go +++ b/internal/services/apimanagement/api_management_identity_provider_aadb2c_resource.go @@ -183,21 +183,23 @@ func resourceArmApiManagementIdentityProviderAADB2CRead(d *pluginsdk.ResourceDat d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("client_id", model.Properties.ClientId) - d.Set("signin_tenant", model.Properties.SigninTenant) - d.Set("authority", model.Properties.Authority) - d.Set("signup_policy", model.Properties.SignupPolicyName) - d.Set("signin_policy", model.Properties.SigninPolicyName) - d.Set("profile_editing_policy", model.Properties.ProfileEditingPolicyName) - d.Set("password_reset_policy", model.Properties.PasswordResetPolicyName) - - allowedTenant := "" - if allowedTenants := model.Properties.AllowedTenants; allowedTenants != nil && len(*allowedTenants) > 0 { - t := *allowedTenants - allowedTenant = t[0] + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("client_id", props.ClientId) + d.Set("signin_tenant", props.SigninTenant) + d.Set("authority", props.Authority) + d.Set("signup_policy", props.SignupPolicyName) + d.Set("signin_policy", props.SigninPolicyName) + d.Set("profile_editing_policy", props.ProfileEditingPolicyName) + d.Set("password_reset_policy", props.PasswordResetPolicyName) + + allowedTenant := "" + if allowedTenants := props.AllowedTenants; allowedTenants != nil && len(*allowedTenants) > 0 { + t := *allowedTenants + allowedTenant = t[0] + } + d.Set("allowed_tenant", allowedTenant) } - d.Set("allowed_tenant", allowedTenant) } return nil diff --git a/internal/services/apimanagement/api_management_identity_provider_facebook_resource.go b/internal/services/apimanagement/api_management_identity_provider_facebook_resource.go index 249409419b5a..9ef615368ab4 100644 --- a/internal/services/apimanagement/api_management_identity_provider_facebook_resource.go +++ b/internal/services/apimanagement/api_management_identity_provider_facebook_resource.go @@ -123,8 +123,10 @@ func resourceApiManagementIdentityProviderFacebookRead(d *pluginsdk.ResourceData d.Set("resource_group_name", resourceGroup) d.Set("api_management_name", serviceName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("app_id", model.Properties.ClientId) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("app_id", props.ClientId) + } } return nil diff --git a/internal/services/apimanagement/api_management_identity_provider_google_resource.go b/internal/services/apimanagement/api_management_identity_provider_google_resource.go index 3aea0fa4ca1a..e013198783bd 100644 --- a/internal/services/apimanagement/api_management_identity_provider_google_resource.go +++ b/internal/services/apimanagement/api_management_identity_provider_google_resource.go @@ -124,8 +124,10 @@ func resourceApiManagementIdentityProviderGoogleRead(d *pluginsdk.ResourceData, d.Set("resource_group_name", resourceGroup) d.Set("api_management_name", serviceName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("client_id", model.Properties.ClientId) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("client_id", props.ClientId) + } } return nil diff --git a/internal/services/apimanagement/api_management_identity_provider_microsoft_resource.go b/internal/services/apimanagement/api_management_identity_provider_microsoft_resource.go index c002a6196912..858d8968d1a3 100644 --- a/internal/services/apimanagement/api_management_identity_provider_microsoft_resource.go +++ b/internal/services/apimanagement/api_management_identity_provider_microsoft_resource.go @@ -123,8 +123,10 @@ func resourceApiManagementIdentityProviderMicrosoftRead(d *pluginsdk.ResourceDat d.Set("resource_group_name", resourceGroup) d.Set("api_management_name", serviceName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("client_id", model.Properties.ClientId) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("client_id", props.ClientId) + } } return nil diff --git a/internal/services/apimanagement/api_management_identity_provider_twitter_resource.go b/internal/services/apimanagement/api_management_identity_provider_twitter_resource.go index e1b6db550615..ef2f18031fb7 100644 --- a/internal/services/apimanagement/api_management_identity_provider_twitter_resource.go +++ b/internal/services/apimanagement/api_management_identity_provider_twitter_resource.go @@ -124,8 +124,10 @@ func resourceApiManagementIdentityProviderTwitterRead(d *pluginsdk.ResourceData, d.Set("resource_group_name", resourceGroup) d.Set("api_management_name", serviceName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("api_key", model.Properties.ClientId) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("api_key", props.ClientId) + } } return nil diff --git a/internal/services/apimanagement/api_management_logger_resource.go b/internal/services/apimanagement/api_management_logger_resource.go index d13130533ecb..d75a52b701ff 100644 --- a/internal/services/apimanagement/api_management_logger_resource.go +++ b/internal/services/apimanagement/api_management_logger_resource.go @@ -191,11 +191,11 @@ func resourceApiManagementLoggerRead(d *pluginsdk.ResourceData, meta interface{} if model := resp.Model; model != nil { d.Set("name", pointer.From(model.Name)) - if model.Properties != nil { - d.Set("resource_id", pointer.From(model.Properties.ResourceId)) - d.Set("buffered", pointer.From(model.Properties.IsBuffered)) - d.Set("description", pointer.From(model.Properties.Description)) - if err := d.Set("eventhub", flattenApiManagementLoggerEventHub(d, model.Properties)); err != nil { + if props := model.Properties; props != nil { + d.Set("resource_id", pointer.From(props.ResourceId)) + d.Set("buffered", pointer.From(props.IsBuffered)) + d.Set("description", pointer.From(props.Description)) + if err := d.Set("eventhub", flattenApiManagementLoggerEventHub(d, props)); err != nil { return fmt.Errorf("setting `eventhub`: %s", err) } } diff --git a/internal/services/apimanagement/api_management_named_value_resource.go b/internal/services/apimanagement/api_management_named_value_resource.go index 09204f959c9e..1de7c413de1e 100644 --- a/internal/services/apimanagement/api_management_named_value_resource.go +++ b/internal/services/apimanagement/api_management_named_value_resource.go @@ -171,17 +171,19 @@ func resourceApiManagementNamedValueRead(d *pluginsdk.ResourceData, meta interfa d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("display_name", model.Properties.DisplayName) - d.Set("secret", pointer.From(model.Properties.Secret)) - // API will not return `value` when `secret` is `true`, in which case we shall not set the `value`. Refer to the issue : #6688 - if model.Properties.Secret != nil && !*model.Properties.Secret { - d.Set("value", pointer.From(model.Properties.Value)) - } - if err := d.Set("value_from_key_vault", flattenApiManagementNamedValueKeyVault(model.Properties.KeyVault)); err != nil { - return fmt.Errorf("setting `value_from_key_vault`: %+v", err) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("display_name", props.DisplayName) + d.Set("secret", pointer.From(props.Secret)) + // API will not return `value` when `secret` is `true`, in which case we shall not set the `value`. Refer to the issue : #6688 + if props.Secret != nil && !*props.Secret { + d.Set("value", pointer.From(props.Value)) + } + if err := d.Set("value_from_key_vault", flattenApiManagementNamedValueKeyVault(props.KeyVault)); err != nil { + return fmt.Errorf("setting `value_from_key_vault`: %+v", err) + } + d.Set("tags", pointer.From(props.Tags)) } - d.Set("tags", pointer.From(model.Properties.Tags)) } return nil diff --git a/internal/services/apimanagement/api_management_policy_resource.go b/internal/services/apimanagement/api_management_policy_resource.go index 2825c4c23aac..a063b042893b 100644 --- a/internal/services/apimanagement/api_management_policy_resource.go +++ b/internal/services/apimanagement/api_management_policy_resource.go @@ -167,10 +167,12 @@ func resourceApiManagementPolicyRead(d *pluginsdk.ResourceData, meta interface{} return fmt.Errorf("retrieving %s: %+v", *id, err) } - if model := resp.Model; model != nil && model.Properties != nil { - // when you submit an `xml_link` to the API, the API downloads this link and stores it as `xml_content` - // as such there is no way to set `xml_link` and we'll let Terraform handle it - d.Set("xml_content", html.UnescapeString(model.Properties.Value)) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + // when you submit an `xml_link` to the API, the API downloads this link and stores it as `xml_content` + // as such there is no way to set `xml_link` and we'll let Terraform handle it + d.Set("xml_content", html.UnescapeString(props.Value)) + } } return nil diff --git a/internal/services/apimanagement/api_management_product_data_source.go b/internal/services/apimanagement/api_management_product_data_source.go index 48e79bfe993c..627012db242c 100644 --- a/internal/services/apimanagement/api_management_product_data_source.go +++ b/internal/services/apimanagement/api_management_product_data_source.go @@ -88,14 +88,16 @@ func dataSourceApiManagementProductRead(d *pluginsdk.ResourceData, meta interfac d.SetId(id.ID()) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("approval_required", pointer.From(model.Properties.ApprovalRequired)) - d.Set("description", pointer.From(model.Properties.Description)) - d.Set("display_name", model.Properties.DisplayName) - d.Set("published", pointer.From(model.Properties.State) == product.ProductStatePublished) - d.Set("subscriptions_limit", pointer.From(model.Properties.SubscriptionsLimit)) - d.Set("subscription_required", pointer.From(model.Properties.SubscriptionRequired)) - d.Set("terms", pointer.From(model.Properties.Terms)) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("approval_required", pointer.From(props.ApprovalRequired)) + d.Set("description", pointer.From(props.Description)) + d.Set("display_name", props.DisplayName) + d.Set("published", pointer.From(props.State) == product.ProductStatePublished) + d.Set("subscriptions_limit", pointer.From(props.SubscriptionsLimit)) + d.Set("subscription_required", pointer.From(props.SubscriptionRequired)) + d.Set("terms", pointer.From(props.Terms)) + } } return nil diff --git a/internal/services/apimanagement/api_management_product_policy_resource.go b/internal/services/apimanagement/api_management_product_policy_resource.go index b7a42aff594b..c292ec0e9ded 100644 --- a/internal/services/apimanagement/api_management_product_policy_resource.go +++ b/internal/services/apimanagement/api_management_product_policy_resource.go @@ -148,10 +148,12 @@ func resourceApiManagementProductPolicyRead(d *pluginsdk.ResourceData, meta inte d.Set("api_management_name", id.ServiceName) d.Set("product_id", id.ProductId) - if model := resp.Model; model != nil && model.Properties != nil { - // when you submit an `xml_link` to the API, the API downloads this link and stores it as `xml_content` - // as such there is no way to set `xml_link` and we'll let Terraform handle it - d.Set("xml_content", html.UnescapeString(model.Properties.Value)) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + // when you submit an `xml_link` to the API, the API downloads this link and stores it as `xml_content` + // as such there is no way to set `xml_link` and we'll let Terraform handle it + d.Set("xml_content", html.UnescapeString(props.Value)) + } } return nil diff --git a/internal/services/apimanagement/api_management_product_resource.go b/internal/services/apimanagement/api_management_product_resource.go index 27fc32bcbe29..e7368bc1368c 100644 --- a/internal/services/apimanagement/api_management_product_resource.go +++ b/internal/services/apimanagement/api_management_product_resource.go @@ -173,14 +173,16 @@ func resourceApiManagementProductRead(d *pluginsdk.ResourceData, meta interface{ d.Set("api_management_name", id.ServiceName) d.Set("resource_group_name", id.ResourceGroupName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("approval_required", pointer.From(model.Properties.ApprovalRequired)) - d.Set("description", pointer.From(model.Properties.Description)) - d.Set("display_name", model.Properties.DisplayName) - d.Set("published", pointer.From(model.Properties.State) == product.ProductStatePublished) - d.Set("subscriptions_limit", pointer.From(model.Properties.SubscriptionsLimit)) - d.Set("subscription_required", pointer.From(model.Properties.SubscriptionRequired)) - d.Set("terms", pointer.From(model.Properties.Terms)) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("approval_required", pointer.From(props.ApprovalRequired)) + d.Set("description", pointer.From(props.Description)) + d.Set("display_name", props.DisplayName) + d.Set("published", pointer.From(props.State) == product.ProductStatePublished) + d.Set("subscriptions_limit", pointer.From(props.SubscriptionsLimit)) + d.Set("subscription_required", pointer.From(props.SubscriptionRequired)) + d.Set("terms", pointer.From(props.Terms)) + } } return nil diff --git a/internal/services/apimanagement/api_management_redis_cache_resource.go b/internal/services/apimanagement/api_management_redis_cache_resource.go index 48f6233a5c53..0bc8ee3389c4 100644 --- a/internal/services/apimanagement/api_management_redis_cache_resource.go +++ b/internal/services/apimanagement/api_management_redis_cache_resource.go @@ -168,16 +168,18 @@ func resourceApiManagementRedisCacheRead(d *pluginsdk.ResourceData, meta interfa } d.Set("name", id.CacheId) d.Set("api_management_id", apimanagementservice.NewServiceID(subscriptionId, id.ResourceGroupName, id.ServiceName).ID()) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("description", pointer.From(model.Properties.Description)) - - cacheId := "" - if model.Properties.ResourceId != nil { - // correct the resourceID issue: "https://management.azure.com//subscriptions/xx/resourceGroups/xx/providers/Microsoft.Cache/Redis/xx" - cacheId = strings.TrimPrefix(*model.Properties.ResourceId, *resourceManagerEndpoint) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("description", pointer.From(props.Description)) + + cacheId := "" + if props.ResourceId != nil { + // correct the resourceID issue: "https://management.azure.com//subscriptions/xx/resourceGroups/xx/providers/Microsoft.Cache/Redis/xx" + cacheId = strings.TrimPrefix(*props.ResourceId, *resourceManagerEndpoint) + } + d.Set("redis_cache_id", cacheId) + d.Set("cache_location", props.UseFromLocation) } - d.Set("redis_cache_id", cacheId) - d.Set("cache_location", model.Properties.UseFromLocation) } return nil } diff --git a/internal/services/apimanagement/api_management_resource.go b/internal/services/apimanagement/api_management_resource.go index 3d86b0897554..2b56def60f2c 100644 --- a/internal/services/apimanagement/api_management_resource.go +++ b/internal/services/apimanagement/api_management_resource.go @@ -1218,9 +1218,7 @@ func apiManagementRefreshFunc(ctx context.Context, client *apimanagementservice. state := "" if model := resp.Model; model != nil { - if model.Properties.ProvisioningState != nil { - state = pointer.From(model.Properties.ProvisioningState) - } + state = pointer.From(model.Properties.ProvisioningState) } return resp, state, nil diff --git a/internal/services/apimanagement/api_management_subscription_resource.go b/internal/services/apimanagement/api_management_subscription_resource.go index 9e4deb5e8314..6c3a3fb4ab7a 100644 --- a/internal/services/apimanagement/api_management_subscription_resource.go +++ b/internal/services/apimanagement/api_management_subscription_resource.go @@ -238,29 +238,31 @@ func resourceApiManagementSubscriptionRead(d *pluginsdk.ResourceData, meta inter d.Set("resource_group_name", id.ResourceGroupName) d.Set("api_management_name", id.ServiceName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("display_name", pointer.From(model.Properties.DisplayName)) - d.Set("state", string(model.Properties.State)) - productId := "" - apiId := "" - // check if the subscription is for all apis or a specific product/ api - if model.Properties.Scope != "" && !strings.HasSuffix(model.Properties.Scope, "/apis") { - // the scope is either a product or api id - parseId, err := product.ParseProductIDInsensitively(model.Properties.Scope) - if err == nil { - productId = parseId.ID() - } else { - parsedApiId, err := api.ParseApiIDInsensitively(model.Properties.Scope) - if err != nil { - return fmt.Errorf("parsing scope into product/ api id %q: %+v", model.Properties.Scope, err) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("display_name", pointer.From(props.DisplayName)) + d.Set("state", string(props.State)) + productId := "" + apiId := "" + // check if the subscription is for all apis or a specific product/ api + if props.Scope != "" && !strings.HasSuffix(props.Scope, "/apis") { + // the scope is either a product or api id + parseId, err := product.ParseProductIDInsensitively(props.Scope) + if err == nil { + productId = parseId.ID() + } else { + parsedApiId, err := api.ParseApiIDInsensitively(props.Scope) + if err != nil { + return fmt.Errorf("parsing scope into product/ api id %q: %+v", props.Scope, err) + } + apiId = parsedApiId.ID() } - apiId = parsedApiId.ID() } + d.Set("product_id", productId) + d.Set("api_id", apiId) + d.Set("user_id", pointer.From(props.OwnerId)) + d.Set("allow_tracing", pointer.From(props.AllowTracing)) } - d.Set("product_id", productId) - d.Set("api_id", apiId) - d.Set("user_id", pointer.From(model.Properties.OwnerId)) - d.Set("allow_tracing", pointer.From(model.Properties.AllowTracing)) } // Primary and secondary keys must be got from this additional api diff --git a/internal/services/apimanagement/api_management_tag_resource.go b/internal/services/apimanagement/api_management_tag_resource.go index 71452d6acfad..7eecc5c86267 100644 --- a/internal/services/apimanagement/api_management_tag_resource.go +++ b/internal/services/apimanagement/api_management_tag_resource.go @@ -134,7 +134,9 @@ func resourceApiManagementTagRead(d *pluginsdk.ResourceData, meta interface{}) e d.Set("name", id.TagId) if model := resp.Model; model != nil { - d.Set("display_name", model.Properties.DisplayName) + if props := model.Properties; props != nil { + d.Set("display_name", props.DisplayName) + } } return nil diff --git a/internal/services/apimanagement/api_management_user_data_source.go b/internal/services/apimanagement/api_management_user_data_source.go index 7a9225f97315..b234ad202e74 100644 --- a/internal/services/apimanagement/api_management_user_data_source.go +++ b/internal/services/apimanagement/api_management_user_data_source.go @@ -79,12 +79,14 @@ func dataSourceApiManagementUserRead(d *pluginsdk.ResourceData, meta interface{} d.SetId(id.ID()) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("first_name", pointer.From(model.Properties.FirstName)) - d.Set("last_name", pointer.From(model.Properties.LastName)) - d.Set("email", pointer.From(model.Properties.Email)) - d.Set("note", pointer.From(model.Properties.Note)) - d.Set("state", string(pointer.From(model.Properties.State))) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("first_name", pointer.From(props.FirstName)) + d.Set("last_name", pointer.From(props.LastName)) + d.Set("email", pointer.From(props.Email)) + d.Set("note", pointer.From(props.Note)) + d.Set("state", string(pointer.From(props.State))) + } } return nil diff --git a/internal/services/apimanagement/api_management_user_resource.go b/internal/services/apimanagement/api_management_user_resource.go index 01eadb977e8e..9bd93074fe4a 100644 --- a/internal/services/apimanagement/api_management_user_resource.go +++ b/internal/services/apimanagement/api_management_user_resource.go @@ -184,12 +184,14 @@ func resourceApiManagementUserRead(d *pluginsdk.ResourceData, meta interface{}) d.Set("api_management_name", id.ServiceName) d.Set("resource_group_name", id.ResourceGroupName) - if model := resp.Model; model != nil && model.Properties != nil { - d.Set("first_name", pointer.From(model.Properties.FirstName)) - d.Set("last_name", pointer.From(model.Properties.LastName)) - d.Set("email", pointer.From(model.Properties.Email)) - d.Set("note", pointer.From(model.Properties.Note)) - d.Set("state", string(pointer.From(model.Properties.State))) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("first_name", pointer.From(props.FirstName)) + d.Set("last_name", pointer.From(props.LastName)) + d.Set("email", pointer.From(props.Email)) + d.Set("note", pointer.From(props.Note)) + d.Set("state", string(pointer.From(props.State))) + } } return nil diff --git a/internal/services/apimanagement/migration/policy.go b/internal/services/apimanagement/migration/policy.go index e70fd6327990..ccd6a7430797 100644 --- a/internal/services/apimanagement/migration/policy.go +++ b/internal/services/apimanagement/migration/policy.go @@ -33,10 +33,12 @@ func (ApiManagementPolicyV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return nil, fmt.Errorf("making Read request for API Management Policy (Resource Group %q / API Management Service %q / API %q): %+v", id.ResourceGroupName, id.ServiceName, "policy", err) } - if model := resp.Model; model != nil && model.Properties != nil { - // when you submit an `xml_link` to the API, the API downloads this link and stores it as `xml_content` - // as such there is no way to set `xml_link` and we'll let Terraform handle it - rawState["xml_content"] = html.UnescapeString(model.Properties.Value) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + // when you submit an `xml_link` to the API, the API downloads this link and stores it as `xml_content` + // as such there is no way to set `xml_link` and we'll let Terraform handle it + rawState["xml_content"] = html.UnescapeString(props.Value) + } } return rawState, nil } From 048313a610029e0604519c33485b49c6d41cd622 Mon Sep 17 00:00:00 2001 From: Steph Date: Tue, 15 Aug 2023 08:00:07 +0200 Subject: [PATCH 7/7] nil check provisioning state --- internal/services/apimanagement/api_management_resource.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/services/apimanagement/api_management_resource.go b/internal/services/apimanagement/api_management_resource.go index 2b56def60f2c..0f1dd533d913 100644 --- a/internal/services/apimanagement/api_management_resource.go +++ b/internal/services/apimanagement/api_management_resource.go @@ -1218,7 +1218,9 @@ func apiManagementRefreshFunc(ctx context.Context, client *apimanagementservice. state := "" if model := resp.Model; model != nil { - state = pointer.From(model.Properties.ProvisioningState) + if provisioningState := model.Properties.ProvisioningState; provisioningState != nil { + state = pointer.From(provisioningState) + } } return resp, state, nil